mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-09 10:27:49 +00:00
Rename _.first to _.head, _.rest to _.tail, & _.restParam to _.rest.
This commit is contained in:
258
lodash.js
258
lodash.js
@@ -1410,50 +1410,50 @@
|
|||||||
*
|
*
|
||||||
* The wrapper methods that support shortcut fusion are:
|
* The wrapper methods that support shortcut fusion are:
|
||||||
* `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`, `findLast`,
|
* `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`, `findLast`,
|
||||||
* `first`, `initial`, `last`, `map`, `reject`, `rest`, `reverse`, `slice`,
|
* `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`, `tail`,
|
||||||
* `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
|
* `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
|
||||||
*
|
*
|
||||||
* The chainable wrapper methods are:
|
* The chainable wrapper methods are:
|
||||||
* `after`, `ary`, `assign`, `assignWith`, `at`, `before`, `bind`, `bindAll`,
|
* `after`, `ary`, `assign`, `assignWith`, `at`, `before`, `bind`, `bindAll`,
|
||||||
* `bindKey`, `chain`, `chunk`, `commit`, `compact`, `concat`, `constant`,
|
* `bindKey`, `chain`, `chunk`, `commit`, `compact`, `concat`, `constant`,
|
||||||
* `countBy`, `create`, `curry`, `debounce`, `defaults`, `defaultsDeep`,
|
* `countBy`, `create`, `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`,
|
||||||
* `defer`, `delay`, `difference`, `differenceBy`, `drop`, `dropRight`,
|
* `delay`, `difference`, `differenceBy`, `drop`, `dropRight`, `dropRightWhile`,
|
||||||
* `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
|
* `dropWhile`, `extend`, `extendWith`, `fill`, `filter`, `flatten`, `flattenDeep`,
|
||||||
* `flatten`, `flattenDeep`, `flip`, `flow`, `flowRight`, `forEach`,
|
* `flip`, `flow`, `flowRight`, `forEach`, `forEachRight`, `forIn`, `forInRight`,
|
||||||
* `forEachRight`, `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `functions`,
|
* `forOwn`, `forOwnRight`, `functions`, `groupBy`, `initial`, `intersection`,
|
||||||
* `groupBy`, `initial`, `intersection`, `intersectionBy`, `invert`, `invoke`,
|
* `intersectionBy`, `invert`, `invoke`, `iteratee`, `keyBy`, `keys`, `keysIn`,
|
||||||
* `iteratee`, `keyBy`, `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`,
|
* `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`, `memoize`,
|
||||||
* `matches`, `matchesProperty`, `memoize`, `merge`, `mergeWith` `method`,
|
* `merge`, `mergeWith` `method`, `methodOf`, `mixin`, `modArgs`, `modArgsSet',
|
||||||
* `methodOf`, `mixin`, `modArgs`, `modArgsSet', 'negate`, `omit`, `omitBy`,
|
* 'negate`, `omit`, `omitBy`, `once`, `pairs`, `partial`, `partialRight`,
|
||||||
* `once`, `pairs`, `partial`, `partialRight`, `partition`, `pick`, `pickBy`,
|
* `partition`, `pick`, `pickBy`, `plant`, `property`, `propertyOf`, `pull`,
|
||||||
* `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`, `pullAt`,
|
* `pullAll`, `pullAllBy`, `pullAt`, `push`, `range`, `rearg`, `reject`,
|
||||||
* `push`, `range`, `rearg`, `reject`, `remove`, `rest`, `restParam`, `reverse`,
|
* `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
|
||||||
* `sampleSize`, `set`, `setWith`, `shuffle`, `slice`, `sort`, `sortBy`,
|
* `slice`, `sort`, `sortBy`, `sortByOrder`, `splice`, `spread`, `tail`,
|
||||||
* `sortByOrder`, `splice`, `spread`, `take`, `takeRight`, `takeRightWhile`,
|
* `take`, `takeRight`, `takeRightWhile`, `takeWhile`, `tap`, `throttle`,
|
||||||
* `takeWhile`, `tap`, `throttle`, `thru`, `times`, `toArray`, `toPath`,
|
* `thru`, `times`, `toArray`, `toPath`, `toPlainObject`, `transform`, `union`,
|
||||||
* `toPlainObject`, `transform`, `union`, `unionBy`, `uniq`, `uniqBy`, `unset`,
|
* `unionBy`, `uniq`, `uniqBy`, `unset`, `unshift`, `unzip`, `unzipWith`,
|
||||||
* `unshift`, `unzip`, `unzipWith`, `values`, `valuesIn`, `without`, `wrap`,
|
* `values`, `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `zip`, `zipObject`,
|
||||||
* `xor`, `xorBy`, `zip`, `zipObject`, and `zipWith`
|
* and `zipWith`
|
||||||
*
|
*
|
||||||
* The wrapper methods that are **not** chainable by default are:
|
* The wrapper methods that are **not** chainable by default are:
|
||||||
* `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clone`, `cloneDeep`,
|
* `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clone`, `cloneDeep`,
|
||||||
* `cloneDeepWith`, `cloneWith`, `deburr`, `endsWith`, `eq`, `escape`,
|
* `cloneDeepWith`, `cloneWith`, `deburr`, `endsWith`, `eq`, `escape`,
|
||||||
* `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
|
* `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
|
||||||
* `findLastIndex`, `findLastKey`, `first`, `floor`, `get`, `gt`, `gte`, `has`,
|
* `findLastIndex`, `findLastKey`, `floor`, `get`, `gt`, `gte`, `has`, `hasIn`,
|
||||||
* `hasIn`, `identity`, `includes`, `indexOf`, `inRange`, `isArguments`,
|
* `head`, `identity`, `includes`, `indexOf`, `inRange`, `isArguments`, `isArray`,
|
||||||
* `isArray`, `isArrayLike`, `isArrayLikeObject`, `isBoolean`, `isDate`,
|
* `isArrayLike`, `isArrayLikeObject`, `isBoolean`, `isDate`, `isElement`,
|
||||||
* `isElement`, `isEmpty`, `isEqual`, `isEqualWith`, `isError`, `isFinite`,
|
* `isEmpty`, `isEqual`, `isEqualWith`, `isError`, `isFinite`, `isFunction`,
|
||||||
* `isFunction`, `isInteger`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`,
|
* `isInteger`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
|
||||||
* `isNil`, `isNull`, `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`,
|
* `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
|
||||||
* `isRegExp`, `isSafeInteger`, `isString`, `isUndefined`, `isTypedArray`,
|
* `isSafeInteger`, `isString`, `isUndefined`, `isTypedArray`, `join`, `kebabCase`,
|
||||||
* `join`, `kebabCase`, `last`, `lastIndexOf`, `lowerCase`, `lt`, `lte`, `max`,
|
* `last`, `lastIndexOf`, `lowerCase`, `lt`, `lte`, `max`, `min`, `noConflict`,
|
||||||
* `min`, `noConflict`, `noop`, `now`, `pad`, `padLeft`, `padRight`, `parseInt`,
|
* `noop`, `now`, `pad`, `padLeft`, `padRight`, `parseInt`, `pop`, `random`,
|
||||||
* `pop`, `random`, `reduce`, `reduceRight`, `repeat`, `result`, `round`,
|
* `reduce`, `reduceRight`, `repeat`, `result`, `round`, `runInContext`,
|
||||||
* `runInContext`, `sample`, `shift`, `size`, `snakeCase`, `some`, `sortedIndex`,
|
* `sample`, `shift`, `size`, `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`,
|
||||||
* `sortedIndexBy`, `sortedLastIndex`, `sortedLastIndexBy`, `startCase`,
|
* `sortedLastIndex`, `sortedLastIndexBy`, `startCase`, `startsWith`, `sum`,
|
||||||
* `startsWith`, `sum`, `sumBy`, `template`, `toLower`, `toInteger`, `toString`,
|
* `sumBy`, `template`, `toLower`, `toInteger`, `toString`, `toUpper`, `trim`,
|
||||||
* `toUpper`, `trim`, `trimLeft`, `trimRight`, `trunc`, `unescape`, `uniqueId`,
|
* `trimLeft`, `trimRight`, `trunc`, `unescape`, `uniqueId`, `upperCase`,
|
||||||
* `upperCase`, `value`, and `words`
|
* `value`, and `words`
|
||||||
*
|
*
|
||||||
* @name _
|
* @name _
|
||||||
* @constructor
|
* @constructor
|
||||||
@@ -3675,7 +3675,7 @@
|
|||||||
* @returns {Function} Returns the new assigner function.
|
* @returns {Function} Returns the new assigner function.
|
||||||
*/
|
*/
|
||||||
function createAssigner(assigner) {
|
function createAssigner(assigner) {
|
||||||
return restParam(function(object, sources) {
|
return rest(function(object, sources) {
|
||||||
var index = -1,
|
var index = -1,
|
||||||
length = object == null ? 0 : sources.length,
|
length = object == null ? 0 : sources.length,
|
||||||
customizer = length > 1 ? sources[length - 1] : undefined,
|
customizer = length > 1 ? sources[length - 1] : undefined,
|
||||||
@@ -3969,9 +3969,9 @@
|
|||||||
* @returns {Function} Returns the new invoker function.
|
* @returns {Function} Returns the new invoker function.
|
||||||
*/
|
*/
|
||||||
function createInvoker(arrayFunc) {
|
function createInvoker(arrayFunc) {
|
||||||
return restParam(function(iteratees) {
|
return rest(function(iteratees) {
|
||||||
iteratees = arrayMap(baseFlatten(iteratees), getIteratee());
|
iteratees = arrayMap(baseFlatten(iteratees), getIteratee());
|
||||||
return restParam(function(args) {
|
return rest(function(args) {
|
||||||
var thisArg = this;
|
var thisArg = this;
|
||||||
return arrayFunc(iteratees, function(iteratee) {
|
return arrayFunc(iteratees, function(iteratee) {
|
||||||
return iteratee.apply(thisArg, args);
|
return iteratee.apply(thisArg, args);
|
||||||
@@ -3989,11 +3989,11 @@
|
|||||||
* @returns {Function} Returns the new arguments modifier function.
|
* @returns {Function} Returns the new arguments modifier function.
|
||||||
*/
|
*/
|
||||||
function createModArgs(resolver) {
|
function createModArgs(resolver) {
|
||||||
return restParam(function(func, transforms) {
|
return rest(function(func, transforms) {
|
||||||
transforms = arrayMap(baseFlatten(transforms), getIteratee());
|
transforms = arrayMap(baseFlatten(transforms), getIteratee());
|
||||||
|
|
||||||
var funcsLength = transforms.length;
|
var funcsLength = transforms.length;
|
||||||
return restParam(function(args) {
|
return rest(function(args) {
|
||||||
var index = -1,
|
var index = -1,
|
||||||
length = nativeMin(args.length, funcsLength),
|
length = nativeMin(args.length, funcsLength),
|
||||||
modded = copyArray(args);
|
modded = copyArray(args);
|
||||||
@@ -5004,7 +5004,7 @@
|
|||||||
* _.difference([3, 2, 1], [4, 2]);
|
* _.difference([3, 2, 1], [4, 2]);
|
||||||
* // => [3, 1]
|
* // => [3, 1]
|
||||||
*/
|
*/
|
||||||
var difference = restParam(function(array, values) {
|
var difference = rest(function(array, values) {
|
||||||
return isArrayLikeObject(array)
|
return isArrayLikeObject(array)
|
||||||
? baseDifference(array, baseFlatten(values, false, true))
|
? baseDifference(array, baseFlatten(values, false, true))
|
||||||
: [];
|
: [];
|
||||||
@@ -5031,7 +5031,7 @@
|
|||||||
* _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
|
* _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
|
||||||
* // => [{ 'x': 2 }]
|
* // => [{ 'x': 2 }]
|
||||||
*/
|
*/
|
||||||
var differenceBy = restParam(function(array, values) {
|
var differenceBy = rest(function(array, values) {
|
||||||
var iteratee = last(values);
|
var iteratee = last(values);
|
||||||
if (isArrayLikeObject(iteratee)) {
|
if (isArrayLikeObject(iteratee)) {
|
||||||
iteratee = undefined;
|
iteratee = undefined;
|
||||||
@@ -5309,26 +5309,6 @@
|
|||||||
: -1;
|
: -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the first element of `array`.
|
|
||||||
*
|
|
||||||
* @static
|
|
||||||
* @memberOf _
|
|
||||||
* @category Array
|
|
||||||
* @param {Array} array The array to query.
|
|
||||||
* @returns {*} Returns the first element of `array`.
|
|
||||||
* @example
|
|
||||||
*
|
|
||||||
* _.first([1, 2, 3]);
|
|
||||||
* // => 1
|
|
||||||
*
|
|
||||||
* _.first([]);
|
|
||||||
* // => undefined
|
|
||||||
*/
|
|
||||||
function first(array) {
|
|
||||||
return array ? array[0] : undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flattens `array` a single level.
|
* Flattens `array` a single level.
|
||||||
*
|
*
|
||||||
@@ -5365,6 +5345,27 @@
|
|||||||
return length ? baseFlatten(array, true) : [];
|
return length ? baseFlatten(array, true) : [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the first element of `array`.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
* @memberOf _
|
||||||
|
* @alias first
|
||||||
|
* @category Array
|
||||||
|
* @param {Array} array The array to query.
|
||||||
|
* @returns {*} Returns the first element of `array`.
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* _.head([1, 2, 3]);
|
||||||
|
* // => 1
|
||||||
|
*
|
||||||
|
* _.head([]);
|
||||||
|
* // => undefined
|
||||||
|
*/
|
||||||
|
function head(array) {
|
||||||
|
return array ? array[0] : undefined;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the index at which the first occurrence of `value` is found in `array`
|
* Gets the index at which the first occurrence of `value` is found in `array`
|
||||||
* using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
|
* using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
|
||||||
@@ -5431,7 +5432,7 @@
|
|||||||
* _.intersection([2, 1], [4, 2], [1, 2]);
|
* _.intersection([2, 1], [4, 2], [1, 2]);
|
||||||
* // => [2]
|
* // => [2]
|
||||||
*/
|
*/
|
||||||
var intersection = restParam(function(arrays) {
|
var intersection = rest(function(arrays) {
|
||||||
var mapped = arrayMap(arrays, toArrayLikeObject);
|
var mapped = arrayMap(arrays, toArrayLikeObject);
|
||||||
return (mapped.length && mapped[0] === arrays[0])
|
return (mapped.length && mapped[0] === arrays[0])
|
||||||
? baseIntersection(mapped)
|
? baseIntersection(mapped)
|
||||||
@@ -5458,7 +5459,7 @@
|
|||||||
* _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
|
* _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
|
||||||
* // => [{ 'x': 1 }]
|
* // => [{ 'x': 1 }]
|
||||||
*/
|
*/
|
||||||
var intersectionBy = restParam(function(arrays) {
|
var intersectionBy = rest(function(arrays) {
|
||||||
var iteratee = last(arrays),
|
var iteratee = last(arrays),
|
||||||
mapped = arrayMap(arrays, toArrayLikeObject);
|
mapped = arrayMap(arrays, toArrayLikeObject);
|
||||||
|
|
||||||
@@ -5552,7 +5553,7 @@
|
|||||||
* console.log(array);
|
* console.log(array);
|
||||||
* // => [1, 1]
|
* // => [1, 1]
|
||||||
*/
|
*/
|
||||||
var pull = restParam(pullAll);
|
var pull = rest(pullAll);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method is like `_.pull` except that it accepts an array of values to remove.
|
* This method is like `_.pull` except that it accepts an array of values to remove.
|
||||||
@@ -5631,7 +5632,7 @@
|
|||||||
* console.log(evens);
|
* console.log(evens);
|
||||||
* // => [10, 20]
|
* // => [10, 20]
|
||||||
*/
|
*/
|
||||||
var pullAt = restParam(function(array, indexes) {
|
var pullAt = rest(function(array, indexes) {
|
||||||
indexes = arrayMap(baseFlatten(indexes), String);
|
indexes = arrayMap(baseFlatten(indexes), String);
|
||||||
|
|
||||||
var result = baseAt(array, indexes);
|
var result = baseAt(array, indexes);
|
||||||
@@ -5686,23 +5687,6 @@
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets all but the first element of `array`.
|
|
||||||
*
|
|
||||||
* @static
|
|
||||||
* @memberOf _
|
|
||||||
* @category Array
|
|
||||||
* @param {Array} array The array to query.
|
|
||||||
* @returns {Array} Returns the slice of `array`.
|
|
||||||
* @example
|
|
||||||
*
|
|
||||||
* _.rest([1, 2, 3]);
|
|
||||||
* // => [2, 3]
|
|
||||||
*/
|
|
||||||
function rest(array) {
|
|
||||||
return drop(array, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverses `array` so that the first element becomes the last, the second
|
* Reverses `array` so that the first element becomes the last, the second
|
||||||
* element becomes the second to last, and so on.
|
* element becomes the second to last, and so on.
|
||||||
@@ -5939,6 +5923,23 @@
|
|||||||
: [];
|
: [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets all but the first element of `array`.
|
||||||
|
*
|
||||||
|
* @static
|
||||||
|
* @memberOf _
|
||||||
|
* @category Array
|
||||||
|
* @param {Array} array The array to query.
|
||||||
|
* @returns {Array} Returns the slice of `array`.
|
||||||
|
* @example
|
||||||
|
*
|
||||||
|
* _.tail([1, 2, 3]);
|
||||||
|
* // => [2, 3]
|
||||||
|
*/
|
||||||
|
function tail(array) {
|
||||||
|
return drop(array, 1);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a slice of `array` with `n` elements taken from the beginning.
|
* Creates a slice of `array` with `n` elements taken from the beginning.
|
||||||
*
|
*
|
||||||
@@ -6104,7 +6105,7 @@
|
|||||||
* _.union([2, 1], [4, 2], [1, 2]);
|
* _.union([2, 1], [4, 2], [1, 2]);
|
||||||
* // => [2, 1, 4]
|
* // => [2, 1, 4]
|
||||||
*/
|
*/
|
||||||
var union = restParam(function(arrays) {
|
var union = rest(function(arrays) {
|
||||||
return baseUniq(baseFlatten(arrays, false, true));
|
return baseUniq(baseFlatten(arrays, false, true));
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -6128,7 +6129,7 @@
|
|||||||
* _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
|
* _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
|
||||||
* // => [{ 'x': 1 }, { 'x': 2 }]
|
* // => [{ 'x': 1 }, { 'x': 2 }]
|
||||||
*/
|
*/
|
||||||
var unionBy = restParam(function(arrays) {
|
var unionBy = rest(function(arrays) {
|
||||||
var iteratee = last(arrays);
|
var iteratee = last(arrays);
|
||||||
if (isArrayLikeObject(iteratee)) {
|
if (isArrayLikeObject(iteratee)) {
|
||||||
iteratee = undefined;
|
iteratee = undefined;
|
||||||
@@ -6267,7 +6268,7 @@
|
|||||||
* _.without([1, 2, 1, 3], 1, 2);
|
* _.without([1, 2, 1, 3], 1, 2);
|
||||||
* // => [3]
|
* // => [3]
|
||||||
*/
|
*/
|
||||||
var without = restParam(function(array, values) {
|
var without = rest(function(array, values) {
|
||||||
return isArrayLikeObject(array)
|
return isArrayLikeObject(array)
|
||||||
? baseDifference(array, values)
|
? baseDifference(array, values)
|
||||||
: [];
|
: [];
|
||||||
@@ -6287,7 +6288,7 @@
|
|||||||
* _.xor([2, 1], [4, 2]);
|
* _.xor([2, 1], [4, 2]);
|
||||||
* // => [1, 4]
|
* // => [1, 4]
|
||||||
*/
|
*/
|
||||||
var xor = restParam(function(arrays) {
|
var xor = rest(function(arrays) {
|
||||||
return baseXor(arrayFilter(arrays, isArrayLikeObject));
|
return baseXor(arrayFilter(arrays, isArrayLikeObject));
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -6311,7 +6312,7 @@
|
|||||||
* _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
|
* _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
|
||||||
* // => [{ 'x': 2 }]
|
* // => [{ 'x': 2 }]
|
||||||
*/
|
*/
|
||||||
var xorBy = restParam(function(arrays) {
|
var xorBy = rest(function(arrays) {
|
||||||
var iteratee = last(arrays);
|
var iteratee = last(arrays);
|
||||||
if (isArrayLikeObject(iteratee)) {
|
if (isArrayLikeObject(iteratee)) {
|
||||||
iteratee = undefined;
|
iteratee = undefined;
|
||||||
@@ -6334,7 +6335,7 @@
|
|||||||
* _.zip(['fred', 'barney'], [30, 40], [true, false]);
|
* _.zip(['fred', 'barney'], [30, 40], [true, false]);
|
||||||
* // => [['fred', 30, true], ['barney', 40, false]]
|
* // => [['fred', 30, true], ['barney', 40, false]]
|
||||||
*/
|
*/
|
||||||
var zip = restParam(unzip);
|
var zip = rest(unzip);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The inverse of `_.pairs`; this method returns an object composed from arrays
|
* The inverse of `_.pairs`; this method returns an object composed from arrays
|
||||||
@@ -6392,7 +6393,7 @@
|
|||||||
* _.zipWith([1, 2], [10, 20], [100, 200], _.add);
|
* _.zipWith([1, 2], [10, 20], [100, 200], _.add);
|
||||||
* // => [111, 222]
|
* // => [111, 222]
|
||||||
*/
|
*/
|
||||||
var zipWith = restParam(function(arrays) {
|
var zipWith = rest(function(arrays) {
|
||||||
var length = arrays.length,
|
var length = arrays.length,
|
||||||
iteratee = length > 1 ? arrays[length - 1] : undefined;
|
iteratee = length > 1 ? arrays[length - 1] : undefined;
|
||||||
|
|
||||||
@@ -6425,7 +6426,7 @@
|
|||||||
* .map(function(o) {
|
* .map(function(o) {
|
||||||
* return o.user + ' is ' + o.age;
|
* return o.user + ' is ' + o.age;
|
||||||
* })
|
* })
|
||||||
* .first()
|
* .head()
|
||||||
* .value();
|
* .value();
|
||||||
* // => 'pebbles is 1'
|
* // => 'pebbles is 1'
|
||||||
*/
|
*/
|
||||||
@@ -6501,13 +6502,13 @@
|
|||||||
* ];
|
* ];
|
||||||
*
|
*
|
||||||
* // without explicit chaining
|
* // without explicit chaining
|
||||||
* _(users).first();
|
* _(users).head();
|
||||||
* // => { 'user': 'barney', 'age': 36 }
|
* // => { 'user': 'barney', 'age': 36 }
|
||||||
*
|
*
|
||||||
* // with explicit chaining
|
* // with explicit chaining
|
||||||
* _(users)
|
* _(users)
|
||||||
* .chain()
|
* .chain()
|
||||||
* .first()
|
* .head()
|
||||||
* .pick('user')
|
* .pick('user')
|
||||||
* .value();
|
* .value();
|
||||||
* // => { 'user': 'barney' }
|
* // => { 'user': 'barney' }
|
||||||
@@ -6565,7 +6566,7 @@
|
|||||||
* console.log(array);
|
* console.log(array);
|
||||||
* // => [1]
|
* // => [1]
|
||||||
*/
|
*/
|
||||||
var wrapperConcat = restParam(function(values) {
|
var wrapperConcat = rest(function(values) {
|
||||||
values = baseFlatten(values);
|
values = baseFlatten(values);
|
||||||
return this.thru(function(array) {
|
return this.thru(function(array) {
|
||||||
return arrayConcat(isArray(array) ? array : [Object(array)], values);
|
return arrayConcat(isArray(array) ? array : [Object(array)], values);
|
||||||
@@ -7047,7 +7048,7 @@
|
|||||||
* _.invoke([123, 456], String.prototype.split, '');
|
* _.invoke([123, 456], String.prototype.split, '');
|
||||||
* // => [['1', '2', '3'], ['4', '5', '6']]
|
* // => [['1', '2', '3'], ['4', '5', '6']]
|
||||||
*/
|
*/
|
||||||
var invoke = restParam(function(collection, path, args) {
|
var invoke = rest(function(collection, path, args) {
|
||||||
var index = -1,
|
var index = -1,
|
||||||
isFunc = typeof path == 'function',
|
isFunc = typeof path == 'function',
|
||||||
isProp = isKey(path),
|
isProp = isKey(path),
|
||||||
@@ -7469,7 +7470,7 @@
|
|||||||
* }) );
|
* }) );
|
||||||
* // => [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]]
|
* // => [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]]
|
||||||
*/
|
*/
|
||||||
var sortBy = restParam(function(collection, iteratees) {
|
var sortBy = rest(function(collection, iteratees) {
|
||||||
if (collection == null) {
|
if (collection == null) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
@@ -7672,7 +7673,7 @@
|
|||||||
* bound('hi');
|
* bound('hi');
|
||||||
* // => 'hi fred!'
|
* // => 'hi fred!'
|
||||||
*/
|
*/
|
||||||
var bind = restParam(function(func, thisArg, partials) {
|
var bind = rest(function(func, thisArg, partials) {
|
||||||
var bitmask = BIND_FLAG;
|
var bitmask = BIND_FLAG;
|
||||||
if (partials.length) {
|
if (partials.length) {
|
||||||
var holders = replaceHolders(partials, bind.placeholder);
|
var holders = replaceHolders(partials, bind.placeholder);
|
||||||
@@ -7707,7 +7708,7 @@
|
|||||||
* jQuery('#docs').on('click', view.onClick);
|
* jQuery('#docs').on('click', view.onClick);
|
||||||
* // => logs 'clicked docs' when the element is clicked
|
* // => logs 'clicked docs' when the element is clicked
|
||||||
*/
|
*/
|
||||||
var bindAll = restParam(function(object, methodNames) {
|
var bindAll = rest(function(object, methodNames) {
|
||||||
arrayEach(baseFlatten(methodNames), function(key) {
|
arrayEach(baseFlatten(methodNames), function(key) {
|
||||||
object[key] = bind(object[key], object);
|
object[key] = bind(object[key], object);
|
||||||
});
|
});
|
||||||
@@ -7758,7 +7759,7 @@
|
|||||||
* bound('hi');
|
* bound('hi');
|
||||||
* // => 'hiya fred!'
|
* // => 'hiya fred!'
|
||||||
*/
|
*/
|
||||||
var bindKey = restParam(function(object, key, partials) {
|
var bindKey = rest(function(object, key, partials) {
|
||||||
var bitmask = BIND_FLAG | BIND_KEY_FLAG;
|
var bitmask = BIND_FLAG | BIND_KEY_FLAG;
|
||||||
if (partials.length) {
|
if (partials.length) {
|
||||||
var holders = replaceHolders(partials, bindKey.placeholder);
|
var holders = replaceHolders(partials, bindKey.placeholder);
|
||||||
@@ -8068,7 +8069,7 @@
|
|||||||
* }, 'deferred');
|
* }, 'deferred');
|
||||||
* // logs 'deferred' after one or more milliseconds
|
* // logs 'deferred' after one or more milliseconds
|
||||||
*/
|
*/
|
||||||
var defer = restParam(function(func, args) {
|
var defer = rest(function(func, args) {
|
||||||
return baseDelay(func, 1, args);
|
return baseDelay(func, 1, args);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -8090,7 +8091,7 @@
|
|||||||
* }, 1000, 'later');
|
* }, 1000, 'later');
|
||||||
* // => logs 'later' after one second
|
* // => logs 'later' after one second
|
||||||
*/
|
*/
|
||||||
var delay = restParam(function(func, wait, args) {
|
var delay = rest(function(func, wait, args) {
|
||||||
return baseDelay(func, wait, args);
|
return baseDelay(func, wait, args);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -8413,7 +8414,7 @@
|
|||||||
* greetFred('hi');
|
* greetFred('hi');
|
||||||
* // => 'hi fred'
|
* // => 'hi fred'
|
||||||
*/
|
*/
|
||||||
var partial = restParam(function(func, partials) {
|
var partial = rest(function(func, partials) {
|
||||||
var holders = replaceHolders(partials, partial.placeholder);
|
var holders = replaceHolders(partials, partial.placeholder);
|
||||||
return createWrapper(func, PARTIAL_FLAG, undefined, partials, holders);
|
return createWrapper(func, PARTIAL_FLAG, undefined, partials, holders);
|
||||||
});
|
});
|
||||||
@@ -8449,7 +8450,7 @@
|
|||||||
* sayHelloTo('fred');
|
* sayHelloTo('fred');
|
||||||
* // => 'hello fred'
|
* // => 'hello fred'
|
||||||
*/
|
*/
|
||||||
var partialRight = restParam(function(func, partials) {
|
var partialRight = rest(function(func, partials) {
|
||||||
var holders = replaceHolders(partials, partialRight.placeholder);
|
var holders = replaceHolders(partials, partialRight.placeholder);
|
||||||
return createWrapper(func, PARTIAL_RIGHT_FLAG, undefined, partials, holders);
|
return createWrapper(func, PARTIAL_RIGHT_FLAG, undefined, partials, holders);
|
||||||
});
|
});
|
||||||
@@ -8476,7 +8477,7 @@
|
|||||||
* rearged('b', 'c', 'a')
|
* rearged('b', 'c', 'a')
|
||||||
* // => ['a', 'b', 'c']
|
* // => ['a', 'b', 'c']
|
||||||
*/
|
*/
|
||||||
var rearg = restParam(function(func, indexes) {
|
var rearg = rest(function(func, indexes) {
|
||||||
return createWrapper(func, REARG_FLAG, undefined, undefined, undefined, baseFlatten(indexes));
|
return createWrapper(func, REARG_FLAG, undefined, undefined, undefined, baseFlatten(indexes));
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -8494,7 +8495,7 @@
|
|||||||
* @returns {Function} Returns the new function.
|
* @returns {Function} Returns the new function.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var say = _.restParam(function(what, names) {
|
* var say = _.rest(function(what, names) {
|
||||||
* return what + ' ' + _.initial(names).join(', ') +
|
* return what + ' ' + _.initial(names).join(', ') +
|
||||||
* (_.size(names) > 1 ? ', & ' : '') + _.last(names);
|
* (_.size(names) > 1 ? ', & ' : '') + _.last(names);
|
||||||
* });
|
* });
|
||||||
@@ -8502,7 +8503,7 @@
|
|||||||
* say('hello', 'fred', 'barney', 'pebbles');
|
* say('hello', 'fred', 'barney', 'pebbles');
|
||||||
* // => 'hello fred, barney, & pebbles'
|
* // => 'hello fred, barney, & pebbles'
|
||||||
*/
|
*/
|
||||||
function restParam(func, start) {
|
function rest(func, start) {
|
||||||
if (typeof func != 'function') {
|
if (typeof func != 'function') {
|
||||||
throw new TypeError(FUNC_ERROR_TEXT);
|
throw new TypeError(FUNC_ERROR_TEXT);
|
||||||
}
|
}
|
||||||
@@ -8511,22 +8512,22 @@
|
|||||||
var args = arguments,
|
var args = arguments,
|
||||||
index = -1,
|
index = -1,
|
||||||
length = nativeMax(args.length - start, 0),
|
length = nativeMax(args.length - start, 0),
|
||||||
rest = Array(length);
|
array = Array(length);
|
||||||
|
|
||||||
while (++index < length) {
|
while (++index < length) {
|
||||||
rest[index] = args[start + index];
|
array[index] = args[start + index];
|
||||||
}
|
}
|
||||||
switch (start) {
|
switch (start) {
|
||||||
case 0: return func.call(this, rest);
|
case 0: return func.call(this, array);
|
||||||
case 1: return func.call(this, args[0], rest);
|
case 1: return func.call(this, args[0], array);
|
||||||
case 2: return func.call(this, args[0], args[1], rest);
|
case 2: return func.call(this, args[0], args[1], array);
|
||||||
}
|
}
|
||||||
var otherArgs = Array(start + 1);
|
var otherArgs = Array(start + 1);
|
||||||
index = -1;
|
index = -1;
|
||||||
while (++index < start) {
|
while (++index < start) {
|
||||||
otherArgs[index] = args[index];
|
otherArgs[index] = args[index];
|
||||||
}
|
}
|
||||||
otherArgs[start] = rest;
|
otherArgs[start] = array;
|
||||||
return func.apply(this, otherArgs);
|
return func.apply(this, otherArgs);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -9832,7 +9833,7 @@
|
|||||||
* _.at(['a', 'b', 'c'], 0, 2);
|
* _.at(['a', 'b', 'c'], 0, 2);
|
||||||
* // => ['a', 'c']
|
* // => ['a', 'c']
|
||||||
*/
|
*/
|
||||||
var at = restParam(function(object, paths) {
|
var at = rest(function(object, paths) {
|
||||||
return baseAt(object, baseFlatten(paths));
|
return baseAt(object, baseFlatten(paths));
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -9893,7 +9894,7 @@
|
|||||||
* _.defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' });
|
* _.defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' });
|
||||||
* // => { 'user': 'barney', 'age': 36 }
|
* // => { 'user': 'barney', 'age': 36 }
|
||||||
*/
|
*/
|
||||||
var defaults = restParam(function(args) {
|
var defaults = rest(function(args) {
|
||||||
args.push(undefined, extendDefaults);
|
args.push(undefined, extendDefaults);
|
||||||
return extendWith.apply(undefined, args);
|
return extendWith.apply(undefined, args);
|
||||||
});
|
});
|
||||||
@@ -9916,7 +9917,7 @@
|
|||||||
* // => { 'user': { 'name': 'barney', 'age': 36 } }
|
* // => { 'user': { 'name': 'barney', 'age': 36 } }
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
var defaultsDeep = restParam(function(args) {
|
var defaultsDeep = rest(function(args) {
|
||||||
args.push(undefined, mergeDefaults);
|
args.push(undefined, mergeDefaults);
|
||||||
return mergeWith.apply(undefined, args);
|
return mergeWith.apply(undefined, args);
|
||||||
});
|
});
|
||||||
@@ -10538,7 +10539,7 @@
|
|||||||
* _.omit(object, 'user');
|
* _.omit(object, 'user');
|
||||||
* // => { 'age': 40 }
|
* // => { 'age': 40 }
|
||||||
*/
|
*/
|
||||||
var omit = restParam(function(object, props) {
|
var omit = rest(function(object, props) {
|
||||||
if (object == null) {
|
if (object == null) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
@@ -10608,7 +10609,7 @@
|
|||||||
* _.pick(object, 'user');
|
* _.pick(object, 'user');
|
||||||
* // => { 'user': 'fred' }
|
* // => { 'user': 'fred' }
|
||||||
*/
|
*/
|
||||||
var pick = restParam(function(object, props) {
|
var pick = rest(function(object, props) {
|
||||||
return object == null ? {} : basePick(object, baseFlatten(props));
|
return object == null ? {} : basePick(object, baseFlatten(props));
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -11970,7 +11971,7 @@
|
|||||||
* elements = [];
|
* elements = [];
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
var attempt = restParam(function(func, args) {
|
var attempt = rest(function(func, args) {
|
||||||
try {
|
try {
|
||||||
return func.apply(undefined, args);
|
return func.apply(undefined, args);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -12138,7 +12139,7 @@
|
|||||||
* _.invoke(_.sortBy(objects, _.method(['a', 'b', 'c'])), 'a.b.c');
|
* _.invoke(_.sortBy(objects, _.method(['a', 'b', 'c'])), 'a.b.c');
|
||||||
* // => [1, 2]
|
* // => [1, 2]
|
||||||
*/
|
*/
|
||||||
var method = restParam(function(path, args) {
|
var method = rest(function(path, args) {
|
||||||
return function(object) {
|
return function(object) {
|
||||||
return invokePath(object, path, args);
|
return invokePath(object, path, args);
|
||||||
};
|
};
|
||||||
@@ -12166,7 +12167,7 @@
|
|||||||
* _.map([['a', '2'], ['c', '0']], _.methodOf(object));
|
* _.map([['a', '2'], ['c', '0']], _.methodOf(object));
|
||||||
* // => [2, 0]
|
* // => [2, 0]
|
||||||
*/
|
*/
|
||||||
var methodOf = restParam(function(object, args) {
|
var methodOf = rest(function(object, args) {
|
||||||
return function(path) {
|
return function(path) {
|
||||||
return invokePath(object, path, args);
|
return invokePath(object, path, args);
|
||||||
};
|
};
|
||||||
@@ -12839,7 +12840,6 @@
|
|||||||
lodash.reject = reject;
|
lodash.reject = reject;
|
||||||
lodash.remove = remove;
|
lodash.remove = remove;
|
||||||
lodash.rest = rest;
|
lodash.rest = rest;
|
||||||
lodash.restParam = restParam;
|
|
||||||
lodash.reverse = reverse;
|
lodash.reverse = reverse;
|
||||||
lodash.sampleSize = sampleSize;
|
lodash.sampleSize = sampleSize;
|
||||||
lodash.set = set;
|
lodash.set = set;
|
||||||
@@ -12851,6 +12851,7 @@
|
|||||||
lodash.sortedUniq = sortedUniq;
|
lodash.sortedUniq = sortedUniq;
|
||||||
lodash.sortedUniqBy = sortedUniqBy;
|
lodash.sortedUniqBy = sortedUniqBy;
|
||||||
lodash.spread = spread;
|
lodash.spread = spread;
|
||||||
|
lodash.tail = tail;
|
||||||
lodash.take = take;
|
lodash.take = take;
|
||||||
lodash.takeRight = takeRight;
|
lodash.takeRight = takeRight;
|
||||||
lodash.takeRightWhile = takeRightWhile;
|
lodash.takeRightWhile = takeRightWhile;
|
||||||
@@ -12912,7 +12913,6 @@
|
|||||||
lodash.findLast = findLast;
|
lodash.findLast = findLast;
|
||||||
lodash.findLastIndex = findLastIndex;
|
lodash.findLastIndex = findLastIndex;
|
||||||
lodash.findLastKey = findLastKey;
|
lodash.findLastKey = findLastKey;
|
||||||
lodash.first = first;
|
|
||||||
lodash.floor = floor;
|
lodash.floor = floor;
|
||||||
lodash.forEach = forEach;
|
lodash.forEach = forEach;
|
||||||
lodash.forEachRight = forEachRight;
|
lodash.forEachRight = forEachRight;
|
||||||
@@ -12925,6 +12925,7 @@
|
|||||||
lodash.gte = gte;
|
lodash.gte = gte;
|
||||||
lodash.has = has;
|
lodash.has = has;
|
||||||
lodash.hasIn = hasIn;
|
lodash.hasIn = hasIn;
|
||||||
|
lodash.head = head;
|
||||||
lodash.identity = identity;
|
lodash.identity = identity;
|
||||||
lodash.includes = includes;
|
lodash.includes = includes;
|
||||||
lodash.indexOf = indexOf;
|
lodash.indexOf = indexOf;
|
||||||
@@ -13009,6 +13010,9 @@
|
|||||||
lodash.uniqueId = uniqueId;
|
lodash.uniqueId = uniqueId;
|
||||||
lodash.upperCase = upperCase;
|
lodash.upperCase = upperCase;
|
||||||
|
|
||||||
|
// Add aliases.
|
||||||
|
lodash.first = head;
|
||||||
|
|
||||||
mixin(lodash, (function() {
|
mixin(lodash, (function() {
|
||||||
var source = {};
|
var source = {};
|
||||||
baseForOwn(lodash, function(func, methodName) {
|
baseForOwn(lodash, function(func, methodName) {
|
||||||
@@ -13071,8 +13075,8 @@
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
// Add `LazyWrapper` methods for `_.first` and `_.last`.
|
// Add `LazyWrapper` methods for `_.head` and `_.last`.
|
||||||
arrayEach(['first', 'last'], function(methodName, index) {
|
arrayEach(['head', 'last'], function(methodName, index) {
|
||||||
var takeName = 'take' + (index ? 'Right' : '');
|
var takeName = 'take' + (index ? 'Right' : '');
|
||||||
|
|
||||||
LazyWrapper.prototype[methodName] = function() {
|
LazyWrapper.prototype[methodName] = function() {
|
||||||
@@ -13080,8 +13084,8 @@
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
// Add `LazyWrapper` methods for `_.initial` and `_.rest`.
|
// Add `LazyWrapper` methods for `_.initial` and `_.tail`.
|
||||||
arrayEach(['initial', 'rest'], function(methodName, index) {
|
arrayEach(['initial', 'tail'], function(methodName, index) {
|
||||||
var dropName = 'drop' + (index ? '' : 'Right');
|
var dropName = 'drop' + (index ? '' : 'Right');
|
||||||
|
|
||||||
LazyWrapper.prototype[methodName] = function() {
|
LazyWrapper.prototype[methodName] = function() {
|
||||||
@@ -13094,7 +13098,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
LazyWrapper.prototype.find = function(predicate) {
|
LazyWrapper.prototype.find = function(predicate) {
|
||||||
return this.filter(predicate).first();
|
return this.filter(predicate).head();
|
||||||
};
|
};
|
||||||
|
|
||||||
LazyWrapper.prototype.findLast = function(predicate) {
|
LazyWrapper.prototype.findLast = function(predicate) {
|
||||||
@@ -13138,7 +13142,7 @@
|
|||||||
// Add `LazyWrapper` methods to `lodash.prototype`.
|
// Add `LazyWrapper` methods to `lodash.prototype`.
|
||||||
baseForOwn(LazyWrapper.prototype, function(func, methodName) {
|
baseForOwn(LazyWrapper.prototype, function(func, methodName) {
|
||||||
var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
|
var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
|
||||||
isTaker = /^(?:first|last)$/.test(methodName),
|
isTaker = /^(?:head|last)$/.test(methodName),
|
||||||
retUnwrapped = isTaker || /^find/.test(methodName),
|
retUnwrapped = isTaker || /^find/.test(methodName),
|
||||||
lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName];
|
lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName];
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
return function(_) {
|
return function(_) {
|
||||||
lodash.defaultsDeep(_, { 'templateSettings': lodash.templateSettings });
|
lodash.defaultsDeep(_, { 'templateSettings': lodash.templateSettings });
|
||||||
lodash.mixin(_ , { 'indexBy': lodash.keyBy });
|
lodash.mixin(_ , { 'indexBy': lodash.keyBy, 'rest': lodash.tail });
|
||||||
lodash.mixin(_, lodash.pick(lodash, lodash.difference(lodash.functions(lodash), lodash.functions(_))));
|
lodash.mixin(_, lodash.pick(lodash, lodash.difference(lodash.functions(lodash), lodash.functions(_))));
|
||||||
};
|
};
|
||||||
}());
|
}());
|
||||||
|
|||||||
1252
test/test.js
1252
test/test.js
File diff suppressed because it is too large
Load Diff
@@ -342,16 +342,27 @@
|
|||||||
'methods': 'functions',
|
'methods': 'functions',
|
||||||
'object': 'zipObject',
|
'object': 'zipObject',
|
||||||
'pluck': 'map',
|
'pluck': 'map',
|
||||||
'restArgs': 'restParam',
|
'restParam': 'restArgs',
|
||||||
'select': 'filter',
|
'select': 'filter',
|
||||||
'where': 'filter'
|
'where': 'filter'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var keyMap = {
|
||||||
|
'rest': 'tail',
|
||||||
|
'restArgs': 'rest'
|
||||||
|
};
|
||||||
|
|
||||||
var lodash = _.noConflict();
|
var lodash = _.noConflict();
|
||||||
|
|
||||||
return function(_) {
|
return function(_) {
|
||||||
lodash.defaultsDeep(_, { 'templateSettings': lodash.templateSettings });
|
lodash.defaultsDeep(_, { 'templateSettings': lodash.templateSettings });
|
||||||
lodash.mixin(_, lodash.pick(lodash, lodash.difference(lodash.functions(lodash), lodash.functions(_))));
|
lodash.mixin(_, lodash.pick(lodash, lodash.difference(lodash.functions(lodash), lodash.functions(_))));
|
||||||
|
|
||||||
|
lodash.forOwn(keyMap, function(realName, otherName) {
|
||||||
|
_[otherName] = lodash[realName];
|
||||||
|
_.prototype[otherName] = lodash.prototype[realName];
|
||||||
|
});
|
||||||
|
|
||||||
lodash.forOwn(aliasToReal, function(realName, alias) {
|
lodash.forOwn(aliasToReal, function(realName, alias) {
|
||||||
_[alias] = _[realName];
|
_[alias] = _[realName];
|
||||||
_.prototype[alias] = _.prototype[realName];
|
_.prototype[alias] = _.prototype[realName];
|
||||||
|
|||||||
Reference in New Issue
Block a user