Socket
Socket
Sign inDemoInstall

lodash-es

Package Overview
Dependencies
Maintainers
3
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lodash-es - npm Package Compare versions

Comparing version 4.1.0 to 4.2.0

4

_apply.js

@@ -8,7 +8,7 @@ /**

* @param {*} thisArg The `this` binding of `func`.
* @param {...*} [args] The arguments to invoke `func` with.
* @param {...*} args The arguments to invoke `func` with.
* @returns {*} Returns the result of `func`.
*/
function apply(func, thisArg, args) {
var length = args ? args.length : 0;
var length = args.length;
switch (length) {

@@ -15,0 +15,0 @@ case 0: return func.call(thisArg);

@@ -20,5 +20,5 @@ /**

}
return length ? result : 0;
return result;
}
export default baseSum;

@@ -14,3 +14,2 @@ import chunk from './chunk';

import findLastIndex from './findLastIndex';
import flatMap from './flatMap';
import flatten from './flatten';

@@ -68,13 +67,13 @@ import flattenDeep from './flattenDeep';

differenceWith, drop, dropRight, dropRightWhile, dropWhile,
fill, findIndex, findLastIndex, flatMap, flatten,
flattenDeep, fromPairs, head, indexOf, initial,
intersection, intersectionBy, intersectionWith, join, last,
lastIndexOf, pull, pullAll, pullAllBy, pullAt,
remove, reverse, slice, sortedIndex, sortedIndexBy,
sortedIndexOf, sortedLastIndex, sortedLastIndexBy, sortedLastIndexOf, sortedUniq,
sortedUniqBy, tail, take, takeRight, takeRightWhile,
takeWhile, union, unionBy, unionWith, uniq,
uniqBy, uniqWith, unzip, unzipWith, without,
xor, xorBy, xorWith, zip, zipObject,
zipObjectDeep, zipWith
fill, findIndex, findLastIndex, flatten, flattenDeep,
fromPairs, head, indexOf, initial, intersection,
intersectionBy, intersectionWith, join, last, lastIndexOf,
pull, pullAll, pullAllBy, pullAt, remove,
reverse, slice, sortedIndex, sortedIndexBy, sortedIndexOf,
sortedLastIndex, sortedLastIndexBy, sortedLastIndexOf, sortedUniq, sortedUniqBy,
tail, take, takeRight, takeRightWhile, takeWhile,
union, unionBy, unionWith, uniq, uniqBy,
uniqWith, unzip, unzipWith, without, xor,
xorBy, xorWith, zip, zipObject, zipObjectDeep,
zipWith
};

@@ -14,3 +14,2 @@ export { default as chunk } from './chunk';

export { default as findLastIndex } from './findLastIndex';
export { default as flatMap } from './flatMap';
export { default as flatten } from './flatten';

@@ -17,0 +16,0 @@ export { default as flattenDeep } from './flattenDeep';

import apply from './_apply';
import isError from './isError';
import isObject from './isObject';
import rest from './rest';

@@ -16,3 +16,3 @@

*
* // avoid throwing errors for invalid selectors
* // Avoid throwing errors for invalid selectors.
* var elements = _.attempt(function(selector) {

@@ -30,3 +30,3 @@ * return document.querySelectorAll(selector);

} catch (e) {
return isError(e) ? e : new Error(e);
return isObject(e) ? e : new Error(e);
}

@@ -33,0 +33,0 @@ });

@@ -39,3 +39,3 @@ import createWrapper from './_createWrapper';

*
* // using placeholders
* // Bound with placeholders.
* var bound = _.bind(greet, object, _, '!');

@@ -42,0 +42,0 @@ * bound('hi');

@@ -49,3 +49,3 @@ import createWrapper from './_createWrapper';

*
* // using placeholders
* // Bound with placeholders.
* var bound = _.bindKey(object, 'greet', _, '!');

@@ -52,0 +52,0 @@ * bound('hi');

@@ -9,2 +9,3 @@ import at from './at';

import findLast from './findLast';
import flatMap from './flatMap';
import forEach from './forEach';

@@ -31,7 +32,7 @@ import forEachRight from './forEachRight';

at, countBy, each, eachRight, every,
filter, find, findLast, forEach, forEachRight,
groupBy, includes, invokeMap, keyBy, map,
orderBy, partition, reduce, reduceRight, reject,
sample, sampleSize, shuffle, size, some,
sortBy
filter, find, findLast, flatMap, forEach,
forEachRight, groupBy, includes, invokeMap, keyBy,
map, orderBy, partition, reduce, reduceRight,
reject, sample, sampleSize, shuffle, size,
some, sortBy
};

@@ -9,2 +9,3 @@ export { default as at } from './at';

export { default as findLast } from './findLast';
export { default as flatMap } from './flatMap';
export { default as forEach } from './forEach';

@@ -11,0 +12,0 @@ export { default as forEachRight } from './forEachRight';

@@ -42,3 +42,3 @@ import createWrapper from './_createWrapper';

*
* // using placeholders
* // Curried with placeholders.
* curried(1)(_, 3)(2);

@@ -45,0 +45,0 @@ * // => [1, 2, 3]

@@ -39,3 +39,3 @@ import createWrapper from './_createWrapper';

*
* // using placeholders
* // Curried with placeholders.
* curried(3)(1, _)(2);

@@ -42,0 +42,0 @@ * // => [1, 2, 3]

@@ -43,6 +43,6 @@ import isObject from './isObject';

*
* // avoid costly calculations while the window size is in flux
* // Avoid costly calculations while the window size is in flux.
* jQuery(window).on('resize', _.debounce(calculateLayout, 150));
*
* // invoke `sendMail` when clicked, debouncing subsequent calls
* // Invoke `sendMail` when clicked, debouncing subsequent calls.
* jQuery(element).on('click', _.debounce(sendMail, 300, {

@@ -53,3 +53,3 @@ * 'leading': true,

*
* // ensure `batchLog` is invoked once after 1 second of debounced calls
* // Ensure `batchLog` is invoked once after 1 second of debounced calls.
* var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });

@@ -59,3 +59,3 @@ * var source = new EventSource('/stream');

*
* // cancel a trailing debounced invocation
* // Cancel the trailing debounced invocation.
* jQuery(window).on('popstate', debounced.cancel);

@@ -62,0 +62,0 @@ */

@@ -19,3 +19,3 @@ import baseDelay from './_baseDelay';

* }, 'deferred');
* // logs 'deferred' after one or more milliseconds
* // => logs 'deferred' after one or more milliseconds
*/

@@ -22,0 +22,0 @@ var defer = rest(function(func, args) {

@@ -25,3 +25,3 @@ import baseDifference from './_baseDifference';

*
* // using the `_.property` iteratee shorthand
* // The `_.property` iteratee shorthand.
* _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');

@@ -28,0 +28,0 @@ * // => [{ 'x': 2 }]

@@ -26,11 +26,11 @@ import baseIteratee from './_baseIteratee';

*
* // using the `_.matches` iteratee shorthand
* // The `_.matches` iteratee shorthand.
* _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
* // => objects for ['barney', 'fred']
*
* // using the `_.matchesProperty` iteratee shorthand
* // The `_.matchesProperty` iteratee shorthand.
* _.dropRightWhile(users, ['active', false]);
* // => objects for ['barney']
*
* // using the `_.property` iteratee shorthand
* // The `_.property` iteratee shorthand.
* _.dropRightWhile(users, 'active');

@@ -37,0 +37,0 @@ * // => objects for ['barney', 'fred', 'pebbles']

@@ -26,11 +26,11 @@ import baseIteratee from './_baseIteratee';

*
* // using the `_.matches` iteratee shorthand
* // The `_.matches` iteratee shorthand.
* _.dropWhile(users, { 'user': 'barney', 'active': false });
* // => objects for ['fred', 'pebbles']
*
* // using the `_.matchesProperty` iteratee shorthand
* // The `_.matchesProperty` iteratee shorthand.
* _.dropWhile(users, ['active', false]);
* // => objects for ['pebbles']
*
* // using the `_.property` iteratee shorthand
* // The `_.property` iteratee shorthand.
* _.dropWhile(users, 'active');

@@ -37,0 +37,0 @@ * // => objects for ['barney', 'fred', 'pebbles']

@@ -29,11 +29,11 @@ import arrayEvery from './_arrayEvery';

*
* // using the `_.matches` iteratee shorthand
* // The `_.matches` iteratee shorthand.
* _.every(users, { 'user': 'barney', 'active': false });
* // => false
*
* // using the `_.matchesProperty` iteratee shorthand
* // The `_.matchesProperty` iteratee shorthand.
* _.every(users, ['active', false]);
* // => true
*
* // using the `_.property` iteratee shorthand
* // The `_.property` iteratee shorthand.
* _.every(users, 'active');

@@ -40,0 +40,0 @@ * // => false

@@ -27,11 +27,11 @@ import arrayFilter from './_arrayFilter';

*
* // using the `_.matches` iteratee shorthand
* // The `_.matches` iteratee shorthand.
* _.filter(users, { 'age': 36, 'active': true });
* // => objects for ['barney']
*
* // using the `_.matchesProperty` iteratee shorthand
* // The `_.matchesProperty` iteratee shorthand.
* _.filter(users, ['active', false]);
* // => objects for ['fred']
*
* // using the `_.property` iteratee shorthand
* // The `_.property` iteratee shorthand.
* _.filter(users, 'active');

@@ -38,0 +38,0 @@ * // => objects for ['barney']

@@ -29,11 +29,11 @@ import baseEach from './_baseEach';

*
* // using the `_.matches` iteratee shorthand
* // The `_.matches` iteratee shorthand.
* _.find(users, { 'age': 1, 'active': true });
* // => object for 'pebbles'
*
* // using the `_.matchesProperty` iteratee shorthand
* // The `_.matchesProperty` iteratee shorthand.
* _.find(users, ['active', false]);
* // => object for 'fred'
*
* // using the `_.property` iteratee shorthand
* // The `_.property` iteratee shorthand.
* _.find(users, 'active');

@@ -40,0 +40,0 @@ * // => object for 'barney'

@@ -25,11 +25,11 @@ import baseFindIndex from './_baseFindIndex';

*
* // using the `_.matches` iteratee shorthand
* // The `_.matches` iteratee shorthand.
* _.findIndex(users, { 'user': 'fred', 'active': false });
* // => 1
*
* // using the `_.matchesProperty` iteratee shorthand
* // The `_.matchesProperty` iteratee shorthand.
* _.findIndex(users, ['active', false]);
* // => 0
*
* // using the `_.property` iteratee shorthand
* // The `_.property` iteratee shorthand.
* _.findIndex(users, 'active');

@@ -36,0 +36,0 @@ * // => 2

@@ -26,11 +26,11 @@ import baseFind from './_baseFind';

*
* // using the `_.matches` iteratee shorthand
* // The `_.matches` iteratee shorthand.
* _.findKey(users, { 'age': 1, 'active': true });
* // => 'pebbles'
*
* // using the `_.matchesProperty` iteratee shorthand
* // The `_.matchesProperty` iteratee shorthand.
* _.findKey(users, ['active', false]);
* // => 'fred'
*
* // using the `_.property` iteratee shorthand
* // The `_.property` iteratee shorthand.
* _.findKey(users, 'active');

@@ -37,0 +37,0 @@ * // => 'barney'

@@ -25,11 +25,11 @@ import baseFindIndex from './_baseFindIndex';

*
* // using the `_.matches` iteratee shorthand
* // The `_.matches` iteratee shorthand.
* _.findLastIndex(users, { 'user': 'barney', 'active': true });
* // => 0
*
* // using the `_.matchesProperty` iteratee shorthand
* // The `_.matchesProperty` iteratee shorthand.
* _.findLastIndex(users, ['active', false]);
* // => 2
*
* // using the `_.property` iteratee shorthand
* // The `_.property` iteratee shorthand.
* _.findLastIndex(users, 'active');

@@ -36,0 +36,0 @@ * // => 0

@@ -26,11 +26,11 @@ import baseFind from './_baseFind';

*
* // using the `_.matches` iteratee shorthand
* // The `_.matches` iteratee shorthand.
* _.findLastKey(users, { 'age': 36, 'active': true });
* // => 'barney'
*
* // using the `_.matchesProperty` iteratee shorthand
* // The `_.matchesProperty` iteratee shorthand.
* _.findLastKey(users, ['active', false]);
* // => 'fred'
*
* // using the `_.property` iteratee shorthand
* // The `_.property` iteratee shorthand.
* _.findLastKey(users, 'active');

@@ -37,0 +37,0 @@ * // => 'pebbles'

@@ -1,16 +0,15 @@

import arrayMap from './_arrayMap';
import baseFlatten from './_baseFlatten';
import baseIteratee from './_baseIteratee';
import map from './map';
/**
* Creates an array of flattened values by running each element in `array`
* Creates an array of flattened values by running each element in `collection`
* through `iteratee` and concating its result to the other mapped values.
* The iteratee is invoked with three arguments: (value, index|key, array).
* The iteratee is invoked with three arguments: (value, index|key, collection).
*
* @static
* @memberOf _
* @category Array
* @param {Array} array The array to iterate over.
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
* @param {Function|Object|string} [iteratee=_.identity] The function invoked per iteration.
* @returns {Array} Returns the new array.
* @returns {Array} Returns the new flattened array.
* @example

@@ -25,7 +24,6 @@ *

*/
function flatMap(array, iteratee) {
var length = array ? array.length : 0;
return length ? baseFlatten(arrayMap(array, baseIteratee(iteratee, 3))) : [];
function flatMap(collection, iteratee) {
return baseFlatten(map(collection, iteratee));
}
export default flatMap;

@@ -26,3 +26,3 @@ import createAggregator from './_createAggregator';

*
* // using the `_.property` iteratee shorthand
* // The `_.property` iteratee shorthand.
* _.groupBy(['one', 'two', 'three'], 'length');

@@ -29,0 +29,0 @@ * // => { '3': ['one', 'two'], '5': ['three'] }

@@ -11,4 +11,3 @@ import baseIndexOf from './_baseIndexOf';

* for equality comparisons. If `fromIndex` is negative, it's used as the offset
* from the end of `array`. If `array` is sorted providing `true` for `fromIndex`
* performs a faster binary search.
* from the end of `array`.
*

@@ -27,3 +26,3 @@ * @static

*
* // using `fromIndex`
* // Search from the `fromIndex`.
* _.indexOf([1, 2, 1, 2], 2, 2);

@@ -30,0 +29,0 @@ * // => 3

@@ -24,3 +24,3 @@ import arrayMap from './_arrayMap';

*
* // using the `_.property` iteratee shorthand
* // The `_.property` iteratee shorthand.
* _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');

@@ -27,0 +27,0 @@ * // => [{ 'x': 1 }]

@@ -0,5 +1,3 @@

import baseClone from './_baseClone';
import baseIteratee from './_baseIteratee';
import isArray from './isArray';
import isObjectLike from './isObjectLike';
import matches from './matches';

@@ -24,3 +22,3 @@ /**

*
* // create custom iteratee shorthands
* // Create custom iteratee shorthands.
* _.iteratee = _.wrap(_.iteratee, function(callback, func) {

@@ -37,7 +35,5 @@ * var p = /^(\S+)\s*([<>])\s*(\S+)$/.exec(func);

function iteratee(func) {
return (isObjectLike(func) && !isArray(func))
? matches(func)
: baseIteratee(func);
return baseIteratee(typeof func == 'function' ? func : baseClone(func, true));
}
export default iteratee;

@@ -24,3 +24,3 @@ import indexOfNaN from './_indexOfNaN';

*
* // using `fromIndex`
* // Search from the `fromIndex`.
* _.lastIndexOf([1, 2, 1, 2], 2, 2);

@@ -27,0 +27,0 @@ * // => 1

/**
* @license
* lodash 4.1.0 (Custom Build) <https://lodash.com/>
* lodash 4.2.0 (Custom Build) <https://lodash.com/>
* Build: `lodash modularize exports="es" -o ./`

@@ -47,3 +47,3 @@ * Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/>

/** Used as the semantic version number. */
var VERSION = '4.1.0';
var VERSION = '4.2.0';

@@ -129,3 +129,3 @@ /** Used to compose bitmasks for wrapper metadata. */

lodash.filter = collection.filter;
lodash.flatMap = array.flatMap;
lodash.flatMap = collection.flatMap;
lodash.flatten = array.flatten;

@@ -132,0 +132,0 @@ lodash.flattenDeep = array.flattenDeep;

/**
* @license
* lodash 4.1.0 (Custom Build) <https://lodash.com/>
* lodash 4.2.0 (Custom Build) <https://lodash.com/>
* Build: `lodash modularize exports="es" -o ./`

@@ -5,0 +5,0 @@ * Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/>

@@ -43,3 +43,3 @@ import arrayMap from './_arrayMap';

*
* // using the `_.property` iteratee shorthand
* // The `_.property` iteratee shorthand.
* _.map(users, 'user');

@@ -46,0 +46,0 @@ * // => ['barney', 'fred']

@@ -25,3 +25,3 @@ import baseForOwn from './_baseForOwn';

*
* // using the `_.property` iteratee shorthand
* // The `_.property` iteratee shorthand.
* _.mapValues(users, 'age');

@@ -28,0 +28,0 @@ * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)

@@ -23,3 +23,3 @@ import baseExtremum from './_baseExtremum';

*
* // using the `_.property` iteratee shorthand
* // The `_.property` iteratee shorthand.
* _.maxBy(objects, 'n');

@@ -26,0 +26,0 @@ * // => { 'n': 2 }

@@ -40,3 +40,3 @@ import MapCache from './_MapCache';

*
* // modifying the result cache
* // Modify the result cache.
* values.cache.set(object, ['a', 'b']);

@@ -46,3 +46,3 @@ * values(object);

*
* // replacing `_.memoize.Cache`
* // Replace `_.memoize.Cache`.
* _.memoize.Cache = WeakMap;

@@ -49,0 +49,0 @@ */

@@ -11,2 +11,4 @@ import baseMerge from './_baseMerge';

*
* **Note:** This method mutates `object`.
*
* @static

@@ -13,0 +15,0 @@ * @memberOf _

@@ -23,3 +23,3 @@ import baseExtremum from './_baseExtremum';

*
* // using the `_.property` iteratee shorthand
* // The `_.property` iteratee shorthand.
* _.minBy(objects, 'n');

@@ -26,0 +26,0 @@ * // => { 'n': 1 }

@@ -27,3 +27,3 @@ import baseOrderBy from './_baseOrderBy';

*
* // sort by `user` in ascending order and by `age` in descending order
* // Sort by `user` in ascending order and by `age` in descending order.
* _.orderBy(users, ['user', 'age'], ['asc', 'desc']);

@@ -30,0 +30,0 @@ * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]]

{
"name": "lodash-es",
"version": "4.1.0",
"version": "4.2.0",
"description": "Lodash exported as ES modules.",

@@ -5,0 +5,0 @@ "homepage": "https://lodash.com/custom-builds",

@@ -35,3 +35,3 @@ import createWrapper from './_createWrapper';

*
* // using placeholders
* // Partially applied with placeholders.
* var greetFred = _.partial(greet, _, 'fred');

@@ -38,0 +38,0 @@ * greetFred('hi');

@@ -34,3 +34,3 @@ import createWrapper from './_createWrapper';

*
* // using placeholders
* // Partially applied with placeholders.
* var sayHelloTo = _.partialRight(greet, 'hello', _);

@@ -37,0 +37,0 @@ * sayHelloTo('fred');

@@ -26,11 +26,11 @@ import createAggregator from './_createAggregator';

*
* // using the `_.matches` iteratee shorthand
* // The `_.matches` iteratee shorthand.
* _.partition(users, { 'age': 1, 'active': false });
* // => objects for [['pebbles'], ['barney', 'fred']]
*
* // using the `_.matchesProperty` iteratee shorthand
* // The `_.matchesProperty` iteratee shorthand.
* _.partition(users, ['active', false]);
* // => objects for [['barney', 'pebbles'], ['fred']]
*
* // using the `_.property` iteratee shorthand
* // The `_.property` iteratee shorthand.
* _.partition(users, 'active');

@@ -37,0 +37,0 @@ * // => objects for [['fred'], ['barney', 'pebbles']]

@@ -6,3 +6,3 @@ import baseIteratee from './_baseIteratee';

* Creates an object composed of the `object` properties `predicate` returns
* truthy for. The predicate is invoked with one argument: (value).
* truthy for. The predicate is invoked with two arguments: (value, key).
*

@@ -9,0 +9,0 @@ * @static

@@ -1,2 +0,2 @@

# lodash-es v4.1.0
# lodash-es v4.2.0

@@ -10,2 +10,2 @@ The [lodash](https://lodash.com/) library exported as [ES](http://www.ecma-international.org/ecma-262/6.0/) modules.

See the [package source](https://github.com/lodash/lodash/tree/4.1.0-es) for more details.
See the [package source](https://github.com/lodash/lodash/tree/4.2.0-es) for more details.

@@ -26,11 +26,11 @@ import arrayFilter from './_arrayFilter';

*
* // using the `_.matches` iteratee shorthand
* // The `_.matches` iteratee shorthand.
* _.reject(users, { 'age': 40, 'active': true });
* // => objects for ['barney']
*
* // using the `_.matchesProperty` iteratee shorthand
* // The `_.matchesProperty` iteratee shorthand.
* _.reject(users, ['active', false]);
* // => objects for ['fred']
*
* // using the `_.property` iteratee shorthand
* // The `_.property` iteratee shorthand.
* _.reject(users, 'active');

@@ -37,0 +37,0 @@ * // => objects for ['barney']

@@ -9,2 +9,4 @@ import baseSet from './_baseSet';

*
* **Note:** This method mutates `object`.
*
* @static

@@ -11,0 +13,0 @@ * @memberOf _

@@ -9,2 +9,4 @@ import baseSet from './_baseSet';

*
* **Note:** This method mutates `object`.
*
* @static

@@ -11,0 +13,0 @@ * @memberOf _

@@ -29,11 +29,11 @@ import arraySome from './_arraySome';

*
* // using the `_.matches` iteratee shorthand
* // The `_.matches` iteratee shorthand.
* _.some(users, { 'user': 'barney', 'active': false });
* // => false
*
* // using the `_.matchesProperty` iteratee shorthand
* // The `_.matchesProperty` iteratee shorthand.
* _.some(users, ['active', false]);
* // => true
*
* // using the `_.property` iteratee shorthand
* // The `_.property` iteratee shorthand.
* _.some(users, 'active');

@@ -40,0 +40,0 @@ * // => true

@@ -23,3 +23,3 @@ import baseIteratee from './_baseIteratee';

*
* // using the `_.property` iteratee shorthand
* // The `_.property` iteratee shorthand.
* _.sortedIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x');

@@ -26,0 +26,0 @@ * // => 0

@@ -18,3 +18,3 @@ import baseIteratee from './_baseIteratee';

*
* // using the `_.property` iteratee shorthand
* // The `_.property` iteratee shorthand.
* _.sortedLastIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x');

@@ -21,0 +21,0 @@ * // => 1

@@ -17,3 +17,3 @@ import baseIteratee from './_baseIteratee';

* _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
* // => [1.1, 2.2]
* // => [1.1, 2.3]
*/

@@ -20,0 +20,0 @@ function sortedUniqBy(array, iteratee) {

import apply from './_apply';
import arrayPush from './_arrayPush';
import rest from './rest';
import toInteger from './toInteger';

@@ -6,2 +9,5 @@ /** Used as the `TypeError` message for "Functions" methods. */

/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeMax = Math.max;
/**

@@ -17,2 +23,3 @@ * Creates a function that invokes `func` with the `this` binding of the created

* @param {Function} func The function to spread arguments over.
* @param {number} [start=0] The start position of the spread.
* @returns {Function} Returns the new function.

@@ -28,3 +35,2 @@ * @example

*
* // with a Promise
* var numbers = Promise.all([

@@ -40,11 +46,18 @@ * Promise.resolve(40),

*/
function spread(func) {
function spread(func, start) {
if (typeof func != 'function') {
throw new TypeError(FUNC_ERROR_TEXT);
}
return function(array) {
return apply(func, this, array);
};
start = start === undefined ? 0 : nativeMax(toInteger(start), 0);
return rest(function(args) {
var array = args[start],
otherArgs = args.slice(0, start);
if (array) {
arrayPush(otherArgs, array);
}
return apply(func, this, otherArgs);
});
}
export default spread;

@@ -22,3 +22,3 @@ import baseIteratee from './_baseIteratee';

*
* // using the `_.property` iteratee shorthand
* // The `_.property` iteratee shorthand.
* _.sumBy(objects, 'n');

@@ -25,0 +25,0 @@ * // => 20

@@ -26,11 +26,11 @@ import baseIteratee from './_baseIteratee';

*
* // using the `_.matches` iteratee shorthand
* // The `_.matches` iteratee shorthand.
* _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
* // => objects for ['pebbles']
*
* // using the `_.matchesProperty` iteratee shorthand
* // The `_.matchesProperty` iteratee shorthand.
* _.takeRightWhile(users, ['active', false]);
* // => objects for ['fred', 'pebbles']
*
* // using the `_.property` iteratee shorthand
* // The `_.property` iteratee shorthand.
* _.takeRightWhile(users, 'active');

@@ -37,0 +37,0 @@ * // => []

@@ -26,11 +26,11 @@ import baseIteratee from './_baseIteratee';

*
* // using the `_.matches` iteratee shorthand
* // The `_.matches` iteratee shorthand.
* _.takeWhile(users, { 'user': 'barney', 'active': false });
* // => objects for ['barney']
*
* // using the `_.matchesProperty` iteratee shorthand
* // The `_.matchesProperty` iteratee shorthand.
* _.takeWhile(users, ['active', false]);
* // => objects for ['barney', 'fred']
*
* // using the `_.property` iteratee shorthand
* // The `_.property` iteratee shorthand.
* _.takeWhile(users, 'active');

@@ -37,0 +37,0 @@ * // => []

/**
* This method invokes `interceptor` and returns `value`. The interceptor is
* invoked with one argument; (value). The purpose of this method is to "tap into"
* a method chain in order to perform operations on intermediate results within
* the chain.
* This method invokes `interceptor` and returns `value`. The interceptor
* is invoked with one argument; (value). The purpose of this method is to
* "tap into" a method chain in order to modify intermediate results.
*

@@ -17,2 +16,3 @@ * @static

* .tap(function(array) {
* // Mutate input array.
* array.pop();

@@ -19,0 +19,0 @@ * })

@@ -59,3 +59,3 @@ import assignInDefaults from './_assignInDefaults';

*
* // using the "interpolate" delimiter to create a compiled template
* // Use the "interpolate" delimiter to create a compiled template.
* var compiled = _.template('hello <%= user %>!');

@@ -65,3 +65,3 @@ * compiled({ 'user': 'fred' });

*
* // using the HTML "escape" delimiter to escape data property values
* // Use the HTML "escape" delimiter to escape data property values.
* var compiled = _.template('<b><%- value %></b>');

@@ -71,3 +71,3 @@ * compiled({ 'value': '<script>' });

*
* // using the "evaluate" delimiter to execute JavaScript and generate HTML
* // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
* var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');

@@ -77,3 +77,3 @@ * compiled({ 'users': ['fred', 'barney'] });

*
* // using the internal `print` function in "evaluate" delimiters
* // Use the internal `print` function in "evaluate" delimiters.
* var compiled = _.template('<% print("hello " + user); %>!');

@@ -83,3 +83,3 @@ * compiled({ 'user': 'barney' });

*
* // using the ES delimiter as an alternative to the default "interpolate" delimiter
* // Use the ES delimiter as an alternative to the default "interpolate" delimiter.
* var compiled = _.template('hello ${ user }!');

@@ -89,3 +89,3 @@ * compiled({ 'user': 'pebbles' });

*
* // using custom template delimiters
* // Use custom template delimiters.
* _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;

@@ -96,3 +96,3 @@ * var compiled = _.template('hello {{ user }}!');

*
* // using backslashes to treat delimiters as plain text
* // Use backslashes to treat delimiters as plain text.
* var compiled = _.template('<%= "\\<%- value %\\>" %>');

@@ -102,3 +102,3 @@ * compiled({ 'value': 'ignored' });

*
* // using the `imports` option to import `jQuery` as `jq`
* // Use the `imports` option to import `jQuery` as `jq`.
* var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';

@@ -109,3 +109,3 @@ * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });

*
* // using the `sourceURL` option to specify a custom sourceURL for the template
* // Use the `sourceURL` option to specify a custom sourceURL for the template.
* var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });

@@ -115,3 +115,3 @@ * compiled(data);

*
* // using the `variable` option to ensure a with-statement isn't used in the compiled template
* // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
* var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });

@@ -125,4 +125,4 @@ * compiled.source;

*
* // using the `source` property to inline compiled templates for meaningful
* // line numbers in error messages and a stack trace
* // Use the `source` property to inline compiled templates for meaningful
* // line numbers in error messages and stack traces.
* fs.writeFileSync(path.join(cwd, 'jst.js'), '\

@@ -129,0 +129,0 @@ * var JST = {\

@@ -37,10 +37,10 @@ import debounce from './debounce';

*
* // avoid excessively updating the position while scrolling
* // Avoid excessively updating the position while scrolling.
* jQuery(window).on('scroll', _.throttle(updatePosition, 100));
*
* // invoke `renewToken` when the click event is fired, but not more than once every 5 minutes
* // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
* var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
* jQuery(element).on('click', throttled);
*
* // cancel a trailing throttled invocation
* // Cancel the trailing throttled invocation.
* jQuery(window).on('popstate', throttled.cancel);

@@ -47,0 +47,0 @@ */

/**
* This method is like `_.tap` except that it returns the result of `interceptor`.
* The purpose of this method is to "pass thru" values replacing intermediate
* results in a method chain.
*

@@ -4,0 +6,0 @@ * @static

@@ -24,3 +24,3 @@ import baseFlatten from './_baseFlatten';

*
* // using the `_.property` iteratee shorthand
* // The `_.property` iteratee shorthand.
* _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');

@@ -27,0 +27,0 @@ * // => [{ 'x': 1 }, { 'x': 2 }]

@@ -20,3 +20,3 @@ import baseIteratee from './_baseIteratee';

*
* // using the `_.property` iteratee shorthand
* // The `_.property` iteratee shorthand.
* _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');

@@ -23,0 +23,0 @@ * // => [{ 'x': 1 }, { 'x': 2 }]

@@ -6,2 +6,4 @@ import baseUnset from './_baseUnset';

*
* **Note:** This method mutates `object`.
*
* @static

@@ -8,0 +10,0 @@ * @memberOf _

@@ -17,7 +17,7 @@ import chain from './chain';

*
* // without explicit chaining
* // A sequence without explicit chaining.
* _(users).head();
* // => { 'user': 'barney', 'age': 36 }
*
* // with explicit chaining
* // A sequence with explicit chaining.
* _(users)

@@ -24,0 +24,0 @@ * .chain()

@@ -112,7 +112,7 @@ import LazyWrapper from './_LazyWrapper';

*
* // returns an unwrapped value
* // Returns an unwrapped value.
* wrapped.reduce(_.add);
* // => 6
*
* // returns a wrapped value
* // Returns a wrapped value.
* var squares = wrapped.map(square);

@@ -119,0 +119,0 @@ *

@@ -24,3 +24,3 @@ import arrayFilter from './_arrayFilter';

*
* // using the `_.property` iteratee shorthand
* // The `_.property` iteratee shorthand.
* _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');

@@ -27,0 +27,0 @@ * // => [{ 'x': 2 }]

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc