mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-10 19:07:49 +00:00
Fix style nits.
This commit is contained in:
1
.jscsrc
1
.jscsrc
@@ -77,7 +77,6 @@
|
|||||||
"disallowKeywords": ["with"],
|
"disallowKeywords": ["with"],
|
||||||
"disallowMixedSpacesAndTabs": true,
|
"disallowMixedSpacesAndTabs": true,
|
||||||
"disallowMultipleLineBreaks": true,
|
"disallowMultipleLineBreaks": true,
|
||||||
"disallowMultipleLineStrings": true,
|
|
||||||
"disallowNewlineBeforeBlockStatements": true,
|
"disallowNewlineBeforeBlockStatements": true,
|
||||||
"disallowSpaceAfterObjectKeys": true,
|
"disallowSpaceAfterObjectKeys": true,
|
||||||
"disallowSpaceAfterPrefixUnaryOperators": true,
|
"disallowSpaceAfterPrefixUnaryOperators": true,
|
||||||
|
|||||||
@@ -42,13 +42,13 @@ module.exports = {
|
|||||||
|
|
||||||
/** Used to map ary to method names. */
|
/** Used to map ary to method names. */
|
||||||
'aryMethod': {
|
'aryMethod': {
|
||||||
1:[
|
1: [
|
||||||
'attempt', 'ceil', 'create', 'curry', 'curryRight', 'floor', 'fromPairs',
|
'attempt', 'ceil', 'create', 'curry', 'curryRight', 'floor', 'fromPairs',
|
||||||
'invert', 'iteratee', 'memoize', 'method', 'methodOf', 'mixin', 'over',
|
'invert', 'iteratee', 'memoize', 'method', 'methodOf', 'mixin', 'over',
|
||||||
'overEvery', 'overSome', 'rest', 'reverse', 'round', 'runInContext',
|
'overEvery', 'overSome', 'rest', 'reverse', 'round', 'runInContext',
|
||||||
'template', 'trim', 'trimEnd', 'trimStart', 'uniqueId', 'words'
|
'template', 'trim', 'trimEnd', 'trimStart', 'uniqueId', 'words'
|
||||||
],
|
],
|
||||||
2:[
|
2: [
|
||||||
'add', 'after', 'ary', 'assign', 'at', 'before', 'bind', 'bindKey',
|
'add', 'after', 'ary', 'assign', 'at', 'before', 'bind', 'bindKey',
|
||||||
'chunk', 'cloneDeepWith', 'cloneWith', 'concat', 'countBy', 'curryN',
|
'chunk', 'cloneDeepWith', 'cloneWith', 'concat', 'countBy', 'curryN',
|
||||||
'curryRightN', 'debounce', 'defaults', 'defaultsDeep', 'delay', 'difference',
|
'curryRightN', 'debounce', 'defaults', 'defaultsDeep', 'delay', 'difference',
|
||||||
@@ -69,14 +69,14 @@ module.exports = {
|
|||||||
'uniqWith', 'unset', 'unzipWith', 'without', 'wrap', 'xor', 'zip', 'zipObject',
|
'uniqWith', 'unset', 'unzipWith', 'without', 'wrap', 'xor', 'zip', 'zipObject',
|
||||||
'zipObjectDeep'
|
'zipObjectDeep'
|
||||||
],
|
],
|
||||||
3:[
|
3: [
|
||||||
'assignInWith', 'assignWith', 'clamp', 'differenceBy', 'differenceWith',
|
'assignInWith', 'assignWith', 'clamp', 'differenceBy', 'differenceWith',
|
||||||
'getOr', 'inRange', 'intersectionBy', 'intersectionWith', 'isEqualWith',
|
'getOr', 'inRange', 'intersectionBy', 'intersectionWith', 'isEqualWith',
|
||||||
'isMatchWith', 'mergeWith', 'pullAllBy', 'reduce', 'reduceRight', 'replace',
|
'isMatchWith', 'mergeWith', 'pullAllBy', 'reduce', 'reduceRight', 'replace',
|
||||||
'set', 'slice', 'sortedIndexBy', 'sortedLastIndexBy', 'transform', 'unionBy',
|
'set', 'slice', 'sortedIndexBy', 'sortedLastIndexBy', 'transform', 'unionBy',
|
||||||
'unionWith', 'xorBy', 'xorWith', 'zipWith'
|
'unionWith', 'xorBy', 'xorWith', 'zipWith'
|
||||||
],
|
],
|
||||||
4:[
|
4: [
|
||||||
'fill', 'setWith'
|
'fill', 'setWith'
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ function build(target) {
|
|||||||
var actions = modulePaths.map(function(modulePath) {
|
var actions = modulePaths.map(function(modulePath) {
|
||||||
var moduleName = path.basename(modulePath, '.js');
|
var moduleName = path.basename(modulePath, '.js');
|
||||||
return _.partial(fs.writeFile, path.join(fpPath, moduleName + '.js'), getTemplate(moduleName));
|
return _.partial(fs.writeFile, path.join(fpPath, moduleName + '.js'), getTemplate(moduleName));
|
||||||
})
|
});
|
||||||
|
|
||||||
actions.unshift(_.partial(fs.copy, path.join(__dirname, '../../fp'), fpPath));
|
actions.unshift(_.partial(fs.copy, path.join(__dirname, '../../fp'), fpPath));
|
||||||
actions.push(_.partial(fs.writeFile, path.join(target, 'fp.js'), template.fp()));
|
actions.push(_.partial(fs.writeFile, path.join(target, 'fp.js'), template.fp()));
|
||||||
|
|||||||
@@ -43,11 +43,11 @@
|
|||||||
if (!amd) {
|
if (!amd) {
|
||||||
try {
|
try {
|
||||||
result = require('fs').realpathSync(result);
|
result = require('fs').realpathSync(result);
|
||||||
} catch(e) {}
|
} catch (e) {}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
result = require.resolve(result);
|
result = require.resolve(result);
|
||||||
} catch(e) {}
|
} catch (e) {}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}());
|
}());
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ addEventListener('message', function(e) {
|
|||||||
if (e.data) {
|
if (e.data) {
|
||||||
try {
|
try {
|
||||||
importScripts('../' + e.data);
|
importScripts('../' + e.data);
|
||||||
} catch(e) {
|
} catch (e) {
|
||||||
self._ = { 'VERSION': e.message };
|
self._ = { 'VERSION': e.message };
|
||||||
}
|
}
|
||||||
postMessage(_.VERSION);
|
postMessage(_.VERSION);
|
||||||
|
|||||||
@@ -946,7 +946,7 @@
|
|||||||
assert.deepEqual(args, [undefined, 2, 'b', { 'a': 1 }, { 'b': 2 }], 'fp.extendWith');
|
assert.deepEqual(args, [undefined, 2, 'b', { 'a': 1 }, { 'b': 2 }], 'fp.extendWith');
|
||||||
|
|
||||||
var stack = { '__data__': { 'array': [], 'map': null } },
|
var stack = { '__data__': { 'array': [], 'map': null } },
|
||||||
expected = [[1], [2, 3], 'a', { 'a': [ 1 ] }, { 'a': [2, 3] }, stack];
|
expected = [[1], [2, 3], 'a', { 'a': [1] }, { 'a': [2, 3] }, stack];
|
||||||
|
|
||||||
args = undefined;
|
args = undefined;
|
||||||
value = { 'a': [1] };
|
value = { 'a': [1] };
|
||||||
|
|||||||
40
test/test.js
40
test/test.js
@@ -543,11 +543,11 @@
|
|||||||
' };',
|
' };',
|
||||||
'',
|
'',
|
||||||
" ['" + typedArrays.join("', '") + "'].forEach(function(type) {",
|
" ['" + typedArrays.join("', '") + "'].forEach(function(type) {",
|
||||||
" var Ctor = root[type]",
|
' var Ctor = root[type]',
|
||||||
' if (Ctor) {',
|
' if (Ctor) {',
|
||||||
" object[type.toLowerCase()] = new Ctor(new ArrayBuffer(24));",
|
' object[type.toLowerCase()] = new Ctor(new ArrayBuffer(24));',
|
||||||
' }',
|
' }',
|
||||||
" });",
|
' });',
|
||||||
'',
|
'',
|
||||||
' return object;',
|
' return object;',
|
||||||
'}())'
|
'}())'
|
||||||
@@ -593,7 +593,7 @@
|
|||||||
"_.each(['" + typedArrays.join("', '") + "'], function(type) {",
|
"_.each(['" + typedArrays.join("', '") + "'], function(type) {",
|
||||||
' var Ctor = root[type];',
|
' var Ctor = root[type];',
|
||||||
' if (Ctor) {',
|
' if (Ctor) {',
|
||||||
" object[type.toLowerCase()] = new Ctor(new ArrayBuffer(24));",
|
' object[type.toLowerCase()] = new Ctor(new ArrayBuffer(24));',
|
||||||
' }',
|
' }',
|
||||||
'});',
|
'});',
|
||||||
'',
|
'',
|
||||||
@@ -2367,7 +2367,7 @@
|
|||||||
'undefined values': undefined
|
'undefined values': undefined
|
||||||
};
|
};
|
||||||
|
|
||||||
objects['arrays'].length = 3;
|
objects.arrays.length = 3;
|
||||||
|
|
||||||
var uncloneable = {
|
var uncloneable = {
|
||||||
'DOM elements': body,
|
'DOM elements': body,
|
||||||
@@ -2642,7 +2642,9 @@
|
|||||||
var props = [];
|
var props = [];
|
||||||
|
|
||||||
var objects = lodashStable.transform(_, function(result, value, key) {
|
var objects = lodashStable.transform(_, function(result, value, key) {
|
||||||
if (lodashStable.startsWith(key, '_') && lodashStable.isObject(value) && !lodashStable.isArguments(value) && !lodashStable.isElement(value) && !lodashStable.isFunction(value)) {
|
if (lodashStable.startsWith(key, '_') && lodashStable.isObject(value) &&
|
||||||
|
!lodashStable.isArguments(value) && !lodashStable.isElement(value) &&
|
||||||
|
!lodashStable.isFunction(value)) {
|
||||||
props.push(lodashStable.capitalize(lodashStable.camelCase(key)));
|
props.push(lodashStable.capitalize(lodashStable.camelCase(key)));
|
||||||
result.push(value);
|
result.push(value);
|
||||||
}
|
}
|
||||||
@@ -2664,7 +2666,7 @@
|
|||||||
assert.expect(2);
|
assert.expect(2);
|
||||||
|
|
||||||
if (!isNpm) {
|
if (!isNpm) {
|
||||||
var object = objects['objects'],
|
var object = objects.objects,
|
||||||
actual = _(object)[methodName]();
|
actual = _(object)[methodName]();
|
||||||
|
|
||||||
assert.deepEqual(actual, object);
|
assert.deepEqual(actual, object);
|
||||||
@@ -9451,7 +9453,7 @@
|
|||||||
|
|
||||||
assert.deepEqual(actual, expected);
|
assert.deepEqual(actual, expected);
|
||||||
|
|
||||||
objects = [{ 'a': { 'b': 1 } }, { 'a':{ 'b': 1, 'c': 1 } }, { 'a': { 'b': 1, 'c': undefined } }];
|
objects = [{ 'a': { 'b': 1 } }, { 'a': { 'b': 1, 'c': 1 } }, { 'a': { 'b': 1, 'c': undefined } }];
|
||||||
source = { 'a': { 'c': undefined } };
|
source = { 'a': { 'c': undefined } };
|
||||||
actual = lodashStable.map(objects, predicate);
|
actual = lodashStable.map(objects, predicate);
|
||||||
|
|
||||||
@@ -11618,7 +11620,7 @@
|
|||||||
});
|
});
|
||||||
}());
|
}());
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
QUnit.module('lodash.lowerCase');
|
QUnit.module('lodash.lowerCase');
|
||||||
|
|
||||||
@@ -11632,7 +11634,7 @@
|
|||||||
});
|
});
|
||||||
}());
|
}());
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
QUnit.module('lodash.lowerFirst');
|
QUnit.module('lodash.lowerFirst');
|
||||||
|
|
||||||
@@ -20091,7 +20093,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
lodashStable.times(2, function(index) {
|
lodashStable.times(2, function(index) {
|
||||||
QUnit.test('should trigger a call when invoked repeatedly' + (index ? ' and `leading` is `false`' : ''), function(assert) {
|
QUnit.test('should trigger a call when invoked repeatedly' + (index ? ' and `leading` is `false`' : ''), function(assert) {
|
||||||
assert.expect(1);
|
assert.expect(1);
|
||||||
|
|
||||||
var done = assert.async();
|
var done = assert.async();
|
||||||
@@ -21747,7 +21749,7 @@
|
|||||||
|
|
||||||
lodashStable.each(['uniq', 'uniqBy', 'uniqWith', 'sortedUniq', 'sortedUniqBy'], function(methodName) {
|
lodashStable.each(['uniq', 'uniqBy', 'uniqWith', 'sortedUniq', 'sortedUniqBy'], function(methodName) {
|
||||||
var func = _[methodName],
|
var func = _[methodName],
|
||||||
isSorted = /^sorted/.test(methodName);
|
isSorted = /^sorted/.test(methodName),
|
||||||
objects = [{ 'a': 2 }, { 'a': 3 }, { 'a': 1 }, { 'a': 2 }, { 'a': 3 }, { 'a': 1 }];
|
objects = [{ 'a': 2 }, { 'a': 3 }, { 'a': 1 }, { 'a': 2 }, { 'a': 3 }, { 'a': 1 }];
|
||||||
|
|
||||||
if (isSorted) {
|
if (isSorted) {
|
||||||
@@ -22862,8 +22864,8 @@
|
|||||||
QUnit.module('lodash(...).push');
|
QUnit.module('lodash(...).push');
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
QUnit.test('should append elements to `array`', function(assert) {
|
QUnit.test('should append elements to `array`', function(assert) {
|
||||||
assert.expect(2);
|
assert.expect(2);
|
||||||
|
|
||||||
if (!isNpm) {
|
if (!isNpm) {
|
||||||
var array = [1],
|
var array = [1],
|
||||||
@@ -23227,7 +23229,7 @@
|
|||||||
|
|
||||||
QUnit.module('"Arrays" category methods');
|
QUnit.module('"Arrays" category methods');
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
var args = (function() { return arguments; }(1, null, [3], null, 5)),
|
var args = (function() { return arguments; }(1, null, [3], null, 5)),
|
||||||
sortedArgs = (function() { return arguments; }(1, [3], 5, null, null)),
|
sortedArgs = (function() { return arguments; }(1, [3], 5, null, null)),
|
||||||
array = [1, 2, 3, 4, 5, 6];
|
array = [1, 2, 3, 4, 5, 6];
|
||||||
@@ -23249,7 +23251,7 @@
|
|||||||
assert.deepEqual(_.drop(args, 3), [null, 5], message('drop'));
|
assert.deepEqual(_.drop(args, 3), [null, 5], message('drop'));
|
||||||
assert.deepEqual(_.dropRight(args, 3), [1, null], message('dropRight'));
|
assert.deepEqual(_.dropRight(args, 3), [1, null], message('dropRight'));
|
||||||
assert.deepEqual(_.dropRightWhile(args,identity), [1, null, [3], null], message('dropRightWhile'));
|
assert.deepEqual(_.dropRightWhile(args,identity), [1, null, [3], null], message('dropRightWhile'));
|
||||||
assert.deepEqual(_.dropWhile(args,identity), [ null, [3], null, 5], message('dropWhile'));
|
assert.deepEqual(_.dropWhile(args,identity), [null, [3], null, 5], message('dropWhile'));
|
||||||
assert.deepEqual(_.findIndex(args, identity), 0, message('findIndex'));
|
assert.deepEqual(_.findIndex(args, identity), 0, message('findIndex'));
|
||||||
assert.deepEqual(_.findLastIndex(args, identity), 4, message('findLastIndex'));
|
assert.deepEqual(_.findLastIndex(args, identity), 4, message('findLastIndex'));
|
||||||
assert.deepEqual(_.flatten(args), [1, null, 3, null, 5], message('flatten'));
|
assert.deepEqual(_.flatten(args), [1, null, 3, null, 5], message('flatten'));
|
||||||
@@ -23303,7 +23305,7 @@
|
|||||||
|
|
||||||
QUnit.module('"Strings" category methods');
|
QUnit.module('"Strings" category methods');
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
var stringMethods = [
|
var stringMethods = [
|
||||||
'camelCase',
|
'camelCase',
|
||||||
'capitalize',
|
'capitalize',
|
||||||
@@ -23486,8 +23488,8 @@
|
|||||||
|
|
||||||
switch (methodName) {
|
switch (methodName) {
|
||||||
case 'invokeMap':
|
case 'invokeMap':
|
||||||
actual = func(array, 'toFixed');
|
actual = func(array, 'toFixed');
|
||||||
break;
|
break;
|
||||||
case 'sample':
|
case 'sample':
|
||||||
actual = func(array, 1);
|
actual = func(array, 1);
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user