Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/ui/public/utils/lodash-mixins/__tests__/_move.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import expect from 'expect.js';
describe('_.move', function () {

it('accepts previous from->to syntax', function () {
let list = [
const list = [
1,
1,
1,
Expand All @@ -27,7 +27,7 @@ describe('_.move', function () {
});

it('moves an object up based on a function callback', function () {
let list = [
const list = [
1,
1,
1,
Expand Down Expand Up @@ -55,7 +55,7 @@ describe('_.move', function () {
});

it('moves an object down based on a function callback', function () {
let list = [
const list = [
1,
1,
1,
Expand Down Expand Up @@ -83,7 +83,7 @@ describe('_.move', function () {
});

it('moves an object up based on a where callback', function () {
let list = [
const list = [
{ v: 1 },
{ v: 1 },
{ v: 1 },
Expand All @@ -110,7 +110,7 @@ describe('_.move', function () {


it('moves an object up based on a where callback', function () {
let list = [
const list = [
{ v: 1 },
{ v: 1 },
{ v: 1 },
Expand All @@ -136,7 +136,7 @@ describe('_.move', function () {
});

it('moves an object down based on a pluck callback', function () {
let list = [
const list = [
{ id: 0, normal: true },
{ id: 1, normal: true },
{ id: 2, normal: true },
Expand Down
10 changes: 5 additions & 5 deletions src/ui/public/utils/lodash-mixins/__tests__/_organize_by.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import expect from 'expect.js';
describe('_.organize', function () {

it('it works', function () {
let col = [
const col = [
{
name: 'one',
roles: ['user', 'admin', 'owner']
Expand All @@ -22,7 +22,7 @@ describe('_.organize', function () {
}
];

let resp = _.organizeBy(col, 'roles');
const resp = _.organizeBy(col, 'roles');
expect(resp).to.have.property('user');
expect(resp.user).to.have.length(4);

Expand All @@ -34,15 +34,15 @@ describe('_.organize', function () {
});

it('behaves just like groupBy in normal scenarios', function () {
let col = [
const col = [
{ name: 'one' },
{ name: 'two' },
{ name: 'three' },
{ name: 'four' }
];

let orgs = _.organizeBy(col, 'name');
let groups = _.groupBy(col, 'name');
const orgs = _.organizeBy(col, 'name');
const groups = _.groupBy(col, 'name');
expect(orgs).to.eql(groups);
});
});
6 changes: 3 additions & 3 deletions src/ui/public/utils/lodash-mixins/__tests__/_push_all.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import expect from 'expect.js';
describe('_.pushAll', function () {

it('pushes an entire array into another', function () {
let a = [1, 2, 3, 4];
let b = [5, 6, 7, 8];
const a = [1, 2, 3, 4];
const b = [5, 6, 7, 8];

let output = _.pushAll(b, a);
const output = _.pushAll(b, a);
expect(output).to.be(a);
expect(a).to.eql([1, 2, 3, 4, 5, 6, 7, 8]);
expect(b).to.eql([5, 6, 7, 8]);
Expand Down
22 changes: 11 additions & 11 deletions src/ui/public/utils/lodash-mixins/collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default function (_) {
* @return {array} - the objs argument
*/
move: function (objs, obj, below, qualifier) {
var origI = _.isNumber(obj) ? obj : objs.indexOf(obj);
const origI = _.isNumber(obj) ? obj : objs.indexOf(obj);
if (origI === -1) return objs;

if (_.isNumber(below)) {
Expand All @@ -27,11 +27,11 @@ export default function (_) {
below = !!below;
qualifier = _.callback(qualifier);

var above = !below;
var finder = below ? _.findIndex : _.findLastIndex;
const above = !below;
const finder = below ? _.findIndex : _.findLastIndex;

// find the index of the next/previous obj that meets the qualifications
var targetI = finder(objs, function (otherAgg, otherI) {
const targetI = finder(objs, function (otherAgg, otherI) {
if (below && otherI <= origI) return;
if (above && otherI >= origI) return;
return !!qualifier(otherAgg, otherI);
Expand All @@ -58,23 +58,23 @@ export default function (_) {
* @return {object}
*/
organizeBy: function (collection, callback) {
var buckets = {};
var prop = typeof callback === 'function' ? false : callback;
const buckets = {};
const prop = typeof callback === 'function' ? false : callback;

function add(key, obj) {
if (!buckets[key]) buckets[key] = [];
buckets[key].push(obj);
}

_.each(collection, function (obj) {
var keys = prop === false ? callback(obj) : obj[prop];
const keys = prop === false ? callback(obj) : obj[prop];

if (!_.isArray(keys)) {
add(keys, obj);
return;
}

var length = keys.length;
let length = keys.length;
while (length-- > 0) {
add(keys[length], obj);
}
Expand Down Expand Up @@ -108,14 +108,14 @@ export default function (_) {
* @return {Array} dest
*/
pushAll: function (source, dest) {
var start = dest.length;
var adding = source.length;
const start = dest.length;
const adding = source.length;

// allocate - http://goo.gl/e2i0S0
dest.length = start + adding;

// fill sparse positions
var i = -1;
let i = -1;
while (++i < adding) dest[start + i] = source[i];

return dest;
Expand Down
8 changes: 4 additions & 4 deletions src/ui/public/utils/lodash-mixins/function.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ export default function (_) {
* @return {Function} - the wrapper method
*/
onceWithCb: function (fn) {
var callbacks = [];
const callbacks = [];

// on initial flush, call the init function, but ensure
// that it only happens once
var flush = _.once(function (cntx, args) {
let flush = _.once(function (cntx, args) {
args.push(function finishedOnce() {
// override flush to simply schedule an asynchronous clear
flush = function () {
Expand All @@ -33,8 +33,8 @@ export default function (_) {
});

return function runOnceWithCb() {
var args = [].slice.call(arguments, 0);
var cb = args[args.length - 1];
let args = [].slice.call(arguments, 0);
const cb = args[args.length - 1];

if (typeof cb === 'function') {
callbacks.push(cb);
Expand Down
4 changes: 2 additions & 2 deletions src/ui/public/utils/lodash-mixins/object.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ export default function (_) {
* @return {object}
*/
flattenWith: function (dot, nestedObj, flattenArrays) {
var stack = []; // track key stack
var flatObj = {};
const stack = []; // track key stack
const flatObj = {};

(function flattenObj(obj) {
_.keys(obj).forEach(function (key) {
Expand Down
4 changes: 2 additions & 2 deletions src/ui/public/utils/lodash-mixins/oop.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ export default function (_) {
};
}

var props = {
const props = {
inherits: describeConst(function (SuperClass) {

var prototype = Object.create(SuperClass.prototype, {
const prototype = Object.create(SuperClass.prototype, {
constructor: describeConst(this),
superConstructor: describeConst(SuperClass)
});
Expand Down
8 changes: 4 additions & 4 deletions src/ui/public/utils/lodash-mixins/string.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export default function (_) {

var DOT_PREFIX_RE = /(.).+?\./g;
const DOT_PREFIX_RE = /(.).+?\./g;

_.mixin({

Expand Down Expand Up @@ -39,10 +39,10 @@ export default function (_) {
commaSeperatedList: function (input) {
if (_.isArray(input)) return input;

var source = String(input || '').split(',');
var list = [];
const source = String(input || '').split(',');
const list = [];
while (source.length) {
var item = source.shift().trim();
const item = source.shift().trim();
if (item) list.push(item);
}

Expand Down