Comparing version 3.5.0 to 3.6.0
var baseDifference = require('../internal/baseDifference'), | ||
baseFlatten = require('../internal/baseFlatten'), | ||
isArguments = require('../lang/isArguments'), | ||
isArray = require('../lang/isArray'); | ||
isArray = require('../lang/isArray'), | ||
restParam = require('../function/restParam'); | ||
@@ -10,6 +11,5 @@ /** | ||
* | ||
* **Note:** `SameValueZero` comparisons are like strict equality comparisons, | ||
* e.g. `===`, except that `NaN` matches `NaN`. See the | ||
* [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) | ||
* for more details. | ||
* **Note:** [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) | ||
* comparisons are like strict equality comparisons, e.g. `===`, except that | ||
* `NaN` matches `NaN`. | ||
* | ||
@@ -27,16 +27,8 @@ * @static | ||
*/ | ||
function difference() { | ||
var args = arguments, | ||
index = -1, | ||
length = args.length; | ||
var difference = restParam(function(array, values) { | ||
return (isArray(array) || isArguments(array)) | ||
? baseDifference(array, baseFlatten(values, false, true)) | ||
: []; | ||
}); | ||
while (++index < length) { | ||
var value = args[index]; | ||
if (isArray(value) || isArguments(value)) { | ||
break; | ||
} | ||
} | ||
return baseDifference(value, baseFlatten(args, false, true, ++index)); | ||
} | ||
module.exports = difference; |
var baseCallback = require('../internal/baseCallback'), | ||
baseSlice = require('../internal/baseSlice'); | ||
baseWhile = require('../internal/baseWhile'); | ||
@@ -7,3 +7,3 @@ /** | ||
* Elements are dropped until `predicate` returns falsey. The predicate is | ||
* bound to `thisArg` and invoked with three arguments; (value, index, array). | ||
* bound to `thisArg` and invoked with three arguments: (value, index, array). | ||
* | ||
@@ -55,11 +55,7 @@ * If a property name is provided for `predicate` the created `_.property` | ||
function dropRightWhile(array, predicate, thisArg) { | ||
var length = array ? array.length : 0; | ||
if (!length) { | ||
return []; | ||
} | ||
predicate = baseCallback(predicate, thisArg, 3); | ||
while (length-- && predicate(array[length], length, array)) {} | ||
return baseSlice(array, 0, length + 1); | ||
return (array && array.length) | ||
? baseWhile(array, baseCallback(predicate, thisArg, 3), true, true) | ||
: []; | ||
} | ||
module.exports = dropRightWhile; |
var baseCallback = require('../internal/baseCallback'), | ||
baseSlice = require('../internal/baseSlice'); | ||
baseWhile = require('../internal/baseWhile'); | ||
@@ -7,3 +7,3 @@ /** | ||
* Elements are dropped until `predicate` returns falsey. The predicate is | ||
* bound to `thisArg` and invoked with three arguments; (value, index, array). | ||
* bound to `thisArg` and invoked with three arguments: (value, index, array). | ||
* | ||
@@ -55,12 +55,7 @@ * If a property name is provided for `predicate` the created `_.property` | ||
function dropWhile(array, predicate, thisArg) { | ||
var length = array ? array.length : 0; | ||
if (!length) { | ||
return []; | ||
} | ||
var index = -1; | ||
predicate = baseCallback(predicate, thisArg, 3); | ||
while (++index < length && predicate(array[index], index, array)) {} | ||
return baseSlice(array, index); | ||
return (array && array.length) | ||
? baseWhile(array, baseCallback(predicate, thisArg, 3), true) | ||
: []; | ||
} | ||
module.exports = dropWhile; |
@@ -18,2 +18,15 @@ var baseFill = require('../internal/baseFill'), | ||
* @returns {Array} Returns `array`. | ||
* @example | ||
* | ||
* var array = [1, 2, 3]; | ||
* | ||
* _.fill(array, 'a'); | ||
* console.log(array); | ||
* // => ['a', 'a', 'a'] | ||
* | ||
* _.fill(Array(3), 2); | ||
* // => [2, 2, 2] | ||
* | ||
* _.fill([4, 6, 8], '*', 1, 2); | ||
* // => [4, '*', 8] | ||
*/ | ||
@@ -20,0 +33,0 @@ function fill(array, value, start, end) { |
@@ -1,6 +0,6 @@ | ||
var baseCallback = require('../internal/baseCallback'); | ||
var createFindIndex = require('../internal/createFindIndex'); | ||
/** | ||
* This method is like `_.find` except that it returns the index of the first | ||
* element `predicate` returns truthy for, instead of the element itself. | ||
* element `predicate` returns truthy for instead of the element itself. | ||
* | ||
@@ -51,15 +51,4 @@ * If a property name is provided for `predicate` the created `_.property` | ||
*/ | ||
function findIndex(array, predicate, thisArg) { | ||
var index = -1, | ||
length = array ? array.length : 0; | ||
var findIndex = createFindIndex(); | ||
predicate = baseCallback(predicate, thisArg, 3); | ||
while (++index < length) { | ||
if (predicate(array[index], index, array)) { | ||
return index; | ||
} | ||
} | ||
return -1; | ||
} | ||
module.exports = findIndex; |
@@ -1,2 +0,2 @@ | ||
var baseCallback = require('../internal/baseCallback'); | ||
var createFindIndex = require('../internal/createFindIndex'); | ||
@@ -51,13 +51,4 @@ /** | ||
*/ | ||
function findLastIndex(array, predicate, thisArg) { | ||
var length = array ? array.length : 0; | ||
predicate = baseCallback(predicate, thisArg, 3); | ||
while (length--) { | ||
if (predicate(array[length], length, array)) { | ||
return length; | ||
} | ||
} | ||
return -1; | ||
} | ||
var findLastIndex = createFindIndex(true); | ||
module.exports = findLastIndex; |
@@ -18,7 +18,7 @@ var baseFlatten = require('../internal/baseFlatten'), | ||
* _.flatten([1, [2, 3, [4]]]); | ||
* // => [1, 2, 3, [4]]; | ||
* // => [1, 2, 3, [4]] | ||
* | ||
* // using `isDeep` | ||
* _.flatten([1, [2, 3, [4]]], true); | ||
* // => [1, 2, 3, 4]; | ||
* // => [1, 2, 3, 4] | ||
*/ | ||
@@ -30,5 +30,5 @@ function flatten(array, isDeep, guard) { | ||
} | ||
return length ? baseFlatten(array, isDeep, false, 0) : []; | ||
return length ? baseFlatten(array, isDeep) : []; | ||
} | ||
module.exports = flatten; |
@@ -14,9 +14,9 @@ var baseFlatten = require('../internal/baseFlatten'); | ||
* _.flattenDeep([1, [2, 3, [4]]]); | ||
* // => [1, 2, 3, 4]; | ||
* // => [1, 2, 3, 4] | ||
*/ | ||
function flattenDeep(array) { | ||
var length = array ? array.length : 0; | ||
return length ? baseFlatten(array, true, false, 0) : []; | ||
return length ? baseFlatten(array, true) : []; | ||
} | ||
module.exports = flattenDeep; |
@@ -13,6 +13,5 @@ var baseIndexOf = require('../internal/baseIndexOf'), | ||
* | ||
* **Note:** `SameValueZero` comparisons are like strict equality comparisons, | ||
* e.g. `===`, except that `NaN` matches `NaN`. See the | ||
* [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) | ||
* for more details. | ||
* **Note:** [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) | ||
* comparisons are like strict equality comparisons, e.g. `===`, except that | ||
* `NaN` matches `NaN`. | ||
* | ||
@@ -19,0 +18,0 @@ * @static |
@@ -11,6 +11,5 @@ var baseIndexOf = require('../internal/baseIndexOf'), | ||
* | ||
* **Note:** `SameValueZero` comparisons are like strict equality comparisons, | ||
* e.g. `===`, except that `NaN` matches `NaN`. See the | ||
* [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) | ||
* for more details. | ||
* **Note:** [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) | ||
* comparisons are like strict equality comparisons, e.g. `===`, except that | ||
* `NaN` matches `NaN`. | ||
* | ||
@@ -17,0 +16,0 @@ * @static |
@@ -14,6 +14,6 @@ var baseIndexOf = require('../internal/baseIndexOf'); | ||
* **Notes:** | ||
* - Unlike `_.without`, this method mutates `array`. | ||
* - `SameValueZero` comparisons are like strict equality comparisons, e.g. `===`, | ||
* except that `NaN` matches `NaN`. See the [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) | ||
* for more details. | ||
* - Unlike `_.without`, this method mutates `array` | ||
* - [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) | ||
* comparisons are like strict equality comparisons, e.g. `===`, except | ||
* that `NaN` matches `NaN` | ||
* | ||
@@ -20,0 +20,0 @@ * @static |
@@ -1,4 +0,13 @@ | ||
var baseFlatten = require('../internal/baseFlatten'), | ||
basePullAt = require('../internal/basePullAt'); | ||
var baseAt = require('../internal/baseAt'), | ||
baseCompareAscending = require('../internal/baseCompareAscending'), | ||
baseFlatten = require('../internal/baseFlatten'), | ||
isIndex = require('../internal/isIndex'), | ||
restParam = require('../function/restParam'); | ||
/** Used for native method references. */ | ||
var arrayProto = Array.prototype; | ||
/** Native method references. */ | ||
var splice = arrayProto.splice; | ||
/** | ||
@@ -29,6 +38,20 @@ * Removes elements from `array` corresponding to the given indexes and returns | ||
*/ | ||
function pullAt(array) { | ||
return basePullAt(array || [], baseFlatten(arguments, false, false, 1)); | ||
} | ||
var pullAt = restParam(function(array, indexes) { | ||
array || (array = []); | ||
indexes = baseFlatten(indexes); | ||
var length = indexes.length, | ||
result = baseAt(array, indexes); | ||
indexes.sort(baseCompareAscending); | ||
while (length--) { | ||
var index = parseFloat(indexes[length]); | ||
if (index != previous && isIndex(index)) { | ||
var previous = index; | ||
splice.call(array, index, 1); | ||
} | ||
} | ||
return result; | ||
}); | ||
module.exports = pullAt; |
@@ -12,3 +12,3 @@ var baseCallback = require('../internal/baseCallback'); | ||
* and returns an array of the removed elements. The predicate is bound to | ||
* `thisArg` and invoked with three arguments; (value, index, array). | ||
* `thisArg` and invoked with three arguments: (value, index, array). | ||
* | ||
@@ -15,0 +15,0 @@ * If a property name is provided for `predicate` the created `_.property` |
@@ -1,4 +0,2 @@ | ||
var baseCallback = require('../internal/baseCallback'), | ||
binaryIndex = require('../internal/binaryIndex'), | ||
binaryIndexBy = require('../internal/binaryIndexBy'); | ||
var createSortedIndex = require('../internal/createSortedIndex'); | ||
@@ -12,3 +10,3 @@ /** | ||
* | ||
* If a property name is provided for `predicate` the created `_.property` | ||
* If a property name is provided for `iteratee` the created `_.property` | ||
* style callback returns the property value of the given element. | ||
@@ -20,3 +18,3 @@ * | ||
* | ||
* If an object is provided for `predicate` the created `_.matches` style | ||
* If an object is provided for `iteratee` the created `_.matches` style | ||
* callback returns `true` for elements that have the properties of the given | ||
@@ -55,8 +53,4 @@ * object, else `false`. | ||
*/ | ||
function sortedIndex(array, value, iteratee, thisArg) { | ||
return iteratee == null | ||
? binaryIndex(array, value) | ||
: binaryIndexBy(array, value, baseCallback(iteratee, thisArg, 1)); | ||
} | ||
var sortedIndex = createSortedIndex(); | ||
module.exports = sortedIndex; |
@@ -1,4 +0,2 @@ | ||
var baseCallback = require('../internal/baseCallback'), | ||
binaryIndex = require('../internal/binaryIndex'), | ||
binaryIndexBy = require('../internal/binaryIndexBy'); | ||
var createSortedIndex = require('../internal/createSortedIndex'); | ||
@@ -25,8 +23,4 @@ /** | ||
*/ | ||
function sortedLastIndex(array, value, iteratee, thisArg) { | ||
return iteratee == null | ||
? binaryIndex(array, value, true) | ||
: binaryIndexBy(array, value, baseCallback(iteratee, thisArg, 1), true); | ||
} | ||
var sortedLastIndex = createSortedIndex(true); | ||
module.exports = sortedLastIndex; |
var baseCallback = require('../internal/baseCallback'), | ||
baseSlice = require('../internal/baseSlice'); | ||
baseWhile = require('../internal/baseWhile'); | ||
@@ -7,3 +7,3 @@ /** | ||
* taken until `predicate` returns falsey. The predicate is bound to `thisArg` | ||
* and invoked with three arguments; (value, index, array). | ||
* and invoked with three arguments: (value, index, array). | ||
* | ||
@@ -55,11 +55,7 @@ * If a property name is provided for `predicate` the created `_.property` | ||
function takeRightWhile(array, predicate, thisArg) { | ||
var length = array ? array.length : 0; | ||
if (!length) { | ||
return []; | ||
} | ||
predicate = baseCallback(predicate, thisArg, 3); | ||
while (length-- && predicate(array[length], length, array)) {} | ||
return baseSlice(array, length + 1); | ||
return (array && array.length) | ||
? baseWhile(array, baseCallback(predicate, thisArg, 3), false, true) | ||
: []; | ||
} | ||
module.exports = takeRightWhile; |
var baseCallback = require('../internal/baseCallback'), | ||
baseSlice = require('../internal/baseSlice'); | ||
baseWhile = require('../internal/baseWhile'); | ||
@@ -7,3 +7,3 @@ /** | ||
* are taken until `predicate` returns falsey. The predicate is bound to | ||
* `thisArg` and invoked with three arguments; (value, index, array). | ||
* `thisArg` and invoked with three arguments: (value, index, array). | ||
* | ||
@@ -55,12 +55,7 @@ * If a property name is provided for `predicate` the created `_.property` | ||
function takeWhile(array, predicate, thisArg) { | ||
var length = array ? array.length : 0; | ||
if (!length) { | ||
return []; | ||
} | ||
var index = -1; | ||
predicate = baseCallback(predicate, thisArg, 3); | ||
while (++index < length && predicate(array[index], index, array)) {} | ||
return baseSlice(array, 0, index); | ||
return (array && array.length) | ||
? baseWhile(array, baseCallback(predicate, thisArg, 3)) | ||
: []; | ||
} | ||
module.exports = takeWhile; |
var baseFlatten = require('../internal/baseFlatten'), | ||
baseUniq = require('../internal/baseUniq'); | ||
baseUniq = require('../internal/baseUniq'), | ||
restParam = require('../function/restParam'); | ||
@@ -8,6 +9,5 @@ /** | ||
* | ||
* **Note:** `SameValueZero` comparisons are like strict equality comparisons, | ||
* e.g. `===`, except that `NaN` matches `NaN`. See the | ||
* [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) | ||
* for more details. | ||
* **Note:** [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) | ||
* comparisons are like strict equality comparisons, e.g. `===`, except that | ||
* `NaN` matches `NaN`. | ||
* | ||
@@ -24,6 +24,6 @@ * @static | ||
*/ | ||
function union() { | ||
return baseUniq(baseFlatten(arguments, false, true, 0)); | ||
} | ||
var union = restParam(function(arrays) { | ||
return baseUniq(baseFlatten(arrays, false, true)); | ||
}); | ||
module.exports = union; |
@@ -12,5 +12,5 @@ var baseCallback = require('../internal/baseCallback'), | ||
* uniqueness is computed. The `iteratee` is bound to `thisArg` and invoked | ||
* with three arguments; (value, index, array). | ||
* with three arguments: (value, index, array). | ||
* | ||
* If a property name is provided for `predicate` the created `_.property` | ||
* If a property name is provided for `iteratee` the created `_.property` | ||
* style callback returns the property value of the given element. | ||
@@ -22,10 +22,9 @@ * | ||
* | ||
* If an object is provided for `predicate` the created `_.matches` style | ||
* If an object is provided for `iteratee` the created `_.matches` style | ||
* callback returns `true` for elements that have the properties of the given | ||
* object, else `false`. | ||
* | ||
* **Note:** `SameValueZero` comparisons are like strict equality comparisons, | ||
* e.g. `===`, except that `NaN` matches `NaN`. See the | ||
* [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) | ||
* for more details. | ||
* **Note:** [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) | ||
* comparisons are like strict equality comparisons, e.g. `===`, except that | ||
* `NaN` matches `NaN`. | ||
* | ||
@@ -32,0 +31,0 @@ * @static |
var baseDifference = require('../internal/baseDifference'), | ||
baseSlice = require('../internal/baseSlice'); | ||
isArguments = require('../lang/isArguments'), | ||
isArray = require('../lang/isArray'), | ||
restParam = require('../function/restParam'); | ||
@@ -8,6 +10,5 @@ /** | ||
* | ||
* **Note:** `SameValueZero` comparisons are like strict equality comparisons, | ||
* e.g. `===`, except that `NaN` matches `NaN`. See the | ||
* [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) | ||
* for more details. | ||
* **Note:** [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) | ||
* comparisons are like strict equality comparisons, e.g. `===`, except that | ||
* `NaN` matches `NaN`. | ||
* | ||
@@ -25,6 +26,8 @@ * @static | ||
*/ | ||
function without(array) { | ||
return baseDifference(array, baseSlice(arguments, 1)); | ||
} | ||
var without = restParam(function(array, values) { | ||
return (isArray(array) || isArguments(array)) | ||
? baseDifference(array, values) | ||
: []; | ||
}); | ||
module.exports = without; |
@@ -7,5 +7,4 @@ var baseDifference = require('../internal/baseDifference'), | ||
/** | ||
* Creates an array that is the symmetric difference of the provided arrays. | ||
* See [Wikipedia](https://en.wikipedia.org/wiki/Symmetric_difference) for | ||
* more details. | ||
* Creates an array that is the [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference) | ||
* of the provided arrays. | ||
* | ||
@@ -12,0 +11,0 @@ * @static |
@@ -1,2 +0,3 @@ | ||
var unzip = require('./unzip'); | ||
var restParam = require('../function/restParam'), | ||
unzip = require('./unzip'); | ||
@@ -18,12 +19,4 @@ /** | ||
*/ | ||
function zip() { | ||
var length = arguments.length, | ||
array = Array(length); | ||
var zip = restParam(unzip); | ||
while (length--) { | ||
array[length] = arguments[length]; | ||
} | ||
return unzip(array); | ||
} | ||
module.exports = zip; |
var isArray = require('../lang/isArray'); | ||
/** | ||
* Creates an object composed from arrays of property names and values. Provide | ||
* either a single two dimensional array, e.g. `[[key1, value1], [key2, value2]]` | ||
* or two arrays, one of property names and one of corresponding values. | ||
* The inverse of `_.pairs`; this method returns an object composed from arrays | ||
* of property names and values. Provide either a single two dimensional array, | ||
* e.g. `[[key1, value1], [key2, value2]]` or two arrays, one of property names | ||
* and one of corresponding values. | ||
* | ||
@@ -17,2 +18,5 @@ * @static | ||
* | ||
* _.zipObject([['fred', 30], ['barney', 40]]); | ||
* // => { 'fred': 30, 'barney': 40 } | ||
* | ||
* _.zipObject(['fred', 'barney'], [30, 40]); | ||
@@ -19,0 +23,0 @@ * // => { 'fred': 30, 'barney': 40 } |
@@ -13,4 +13,5 @@ /** | ||
* | ||
* _([1, 2, 3]) | ||
* .last() | ||
* _(' abc ') | ||
* .chain() | ||
* .trim() | ||
* .thru(function(value) { | ||
@@ -20,3 +21,3 @@ * return [value]; | ||
* .value(); | ||
* // => [3] | ||
* // => ['abc'] | ||
*/ | ||
@@ -23,0 +24,0 @@ function thru(value, interceptor, thisArg) { |
var baseAt = require('../internal/baseAt'), | ||
baseFlatten = require('../internal/baseFlatten'), | ||
isLength = require('../internal/isLength'), | ||
restParam = require('../function/restParam'), | ||
toIterable = require('../internal/toIterable'); | ||
@@ -23,6 +24,6 @@ | ||
* | ||
* _.at(['fred', 'barney', 'pebbles'], 0, 2); | ||
* // => ['fred', 'pebbles'] | ||
* _.at(['barney', 'fred', 'pebbles'], 0, 2); | ||
* // => ['barney', 'pebbles'] | ||
*/ | ||
function at(collection) { | ||
var at = restParam(function(collection, props) { | ||
var length = collection ? collection.length : 0; | ||
@@ -32,5 +33,5 @@ if (isLength(length)) { | ||
} | ||
return baseAt(collection, baseFlatten(arguments, false, false, 1)); | ||
} | ||
return baseAt(collection, baseFlatten(props)); | ||
}); | ||
module.exports = at; |
@@ -13,6 +13,6 @@ var createAggregator = require('../internal/createAggregator'); | ||
* of each key is the number of times the key was returned by `iteratee`. | ||
* The `iteratee` is bound to `thisArg` and invoked with three arguments; | ||
* The `iteratee` is bound to `thisArg` and invoked with three arguments: | ||
* (value, index|key, collection). | ||
* | ||
* If a property name is provided for `predicate` the created `_.property` | ||
* If a property name is provided for `iteratee` the created `_.property` | ||
* style callback returns the property value of the given element. | ||
@@ -24,3 +24,3 @@ * | ||
* | ||
* If an object is provided for `predicate` the created `_.matches` style | ||
* If an object is provided for `iteratee` the created `_.matches` style | ||
* callback returns `true` for elements that have the properties of the given | ||
@@ -27,0 +27,0 @@ * object, else `false`. |
var arrayEvery = require('../internal/arrayEvery'), | ||
baseCallback = require('../internal/baseCallback'), | ||
baseEvery = require('../internal/baseEvery'), | ||
isArray = require('../lang/isArray'); | ||
isArray = require('../lang/isArray'), | ||
isIterateeCall = require('../internal/isIterateeCall'); | ||
/** | ||
* Checks if `predicate` returns truthy for **all** elements of `collection`. | ||
* The predicate is bound to `thisArg` and invoked with three arguments; | ||
* The predicate is bound to `thisArg` and invoked with three arguments: | ||
* (value, index|key, collection). | ||
@@ -56,2 +57,5 @@ * | ||
var func = isArray(collection) ? arrayEvery : baseEvery; | ||
if (thisArg && isIterateeCall(collection, predicate, thisArg)) { | ||
predicate = null; | ||
} | ||
if (typeof predicate != 'function' || typeof thisArg != 'undefined') { | ||
@@ -58,0 +62,0 @@ predicate = baseCallback(predicate, thisArg, 3); |
@@ -9,3 +9,3 @@ var arrayFilter = require('../internal/arrayFilter'), | ||
* `predicate` returns truthy for. The predicate is bound to `thisArg` and | ||
* invoked with three arguments; (value, index|key, collection). | ||
* invoked with three arguments: (value, index|key, collection). | ||
* | ||
@@ -12,0 +12,0 @@ * If a property name is provided for `predicate` the created `_.property` |
@@ -1,6 +0,3 @@ | ||
var baseCallback = require('../internal/baseCallback'), | ||
baseEach = require('../internal/baseEach'), | ||
baseFind = require('../internal/baseFind'), | ||
findIndex = require('../array/findIndex'), | ||
isArray = require('../lang/isArray'); | ||
var baseEach = require('../internal/baseEach'), | ||
createFind = require('../internal/createFind'); | ||
@@ -10,3 +7,3 @@ /** | ||
* `predicate` returns truthy for. The predicate is bound to `thisArg` and | ||
* invoked with three arguments; (value, index|key, collection). | ||
* invoked with three arguments: (value, index|key, collection). | ||
* | ||
@@ -58,11 +55,4 @@ * If a property name is provided for `predicate` the created `_.property` | ||
*/ | ||
function find(collection, predicate, thisArg) { | ||
if (isArray(collection)) { | ||
var index = findIndex(collection, predicate, thisArg); | ||
return index > -1 ? collection[index] : undefined; | ||
} | ||
predicate = baseCallback(predicate, thisArg, 3); | ||
return baseFind(collection, predicate, baseEach); | ||
} | ||
var find = createFind(baseEach); | ||
module.exports = find; |
@@ -1,4 +0,3 @@ | ||
var baseCallback = require('../internal/baseCallback'), | ||
baseEachRight = require('../internal/baseEachRight'), | ||
baseFind = require('../internal/baseFind'); | ||
var baseEachRight = require('../internal/baseEachRight'), | ||
createFind = require('../internal/createFind'); | ||
@@ -24,7 +23,4 @@ /** | ||
*/ | ||
function findLast(collection, predicate, thisArg) { | ||
predicate = baseCallback(predicate, thisArg, 3); | ||
return baseFind(collection, predicate, baseEachRight); | ||
} | ||
var findLast = createFind(baseEachRight, true); | ||
module.exports = findLast; |
var arrayEach = require('../internal/arrayEach'), | ||
baseEach = require('../internal/baseEach'), | ||
bindCallback = require('../internal/bindCallback'), | ||
isArray = require('../lang/isArray'); | ||
createForEach = require('../internal/createForEach'); | ||
/** | ||
* Iterates over elements of `collection` invoking `iteratee` for each element. | ||
* The `iteratee` is bound to `thisArg` and invoked with three arguments; | ||
* The `iteratee` is bound to `thisArg` and invoked with three arguments: | ||
* (value, index|key, collection). Iterator functions may exit iteration early | ||
@@ -36,8 +35,4 @@ * by explicitly returning `false`. | ||
*/ | ||
function forEach(collection, iteratee, thisArg) { | ||
return (typeof iteratee == 'function' && typeof thisArg == 'undefined' && isArray(collection)) | ||
? arrayEach(collection, iteratee) | ||
: baseEach(collection, bindCallback(iteratee, thisArg, 3)); | ||
} | ||
var forEach = createForEach(arrayEach, baseEach); | ||
module.exports = forEach; |
var arrayEachRight = require('../internal/arrayEachRight'), | ||
baseEachRight = require('../internal/baseEachRight'), | ||
bindCallback = require('../internal/bindCallback'), | ||
isArray = require('../lang/isArray'); | ||
createForEach = require('../internal/createForEach'); | ||
@@ -22,11 +21,7 @@ /** | ||
* console.log(n); | ||
* }).join(','); | ||
* }).value(); | ||
* // => logs each value from right to left and returns the array | ||
*/ | ||
function forEachRight(collection, iteratee, thisArg) { | ||
return (typeof iteratee == 'function' && typeof thisArg == 'undefined' && isArray(collection)) | ||
? arrayEachRight(collection, iteratee) | ||
: baseEachRight(collection, bindCallback(iteratee, thisArg, 3)); | ||
} | ||
var forEachRight = createForEach(arrayEachRight, baseEachRight); | ||
module.exports = forEachRight; |
@@ -13,6 +13,6 @@ var createAggregator = require('../internal/createAggregator'); | ||
* of each key is an array of the elements responsible for generating the key. | ||
* The `iteratee` is bound to `thisArg` and invoked with three arguments; | ||
* The `iteratee` is bound to `thisArg` and invoked with three arguments: | ||
* (value, index|key, collection). | ||
* | ||
* If a property name is provided for `predicate` the created `_.property` | ||
* If a property name is provided for `iteratee` the created `_.property` | ||
* style callback returns the property value of the given element. | ||
@@ -24,3 +24,3 @@ * | ||
* | ||
* If an object is provided for `predicate` the created `_.matches` style | ||
* If an object is provided for `iteratee` the created `_.matches` style | ||
* callback returns `true` for elements that have the properties of the given | ||
@@ -27,0 +27,0 @@ * object, else `false`. |
var baseIndexOf = require('../internal/baseIndexOf'), | ||
isArray = require('../lang/isArray'), | ||
isIterateeCall = require('../internal/isIterateeCall'), | ||
isLength = require('../internal/isLength'), | ||
@@ -15,6 +16,5 @@ isString = require('../lang/isString'), | ||
* | ||
* **Note:** `SameValueZero` comparisons are like strict equality comparisons, | ||
* e.g. `===`, except that `NaN` matches `NaN`. See the | ||
* [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) | ||
* for more details. | ||
* **Note:** [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) | ||
* comparisons are like strict equality comparisons, e.g. `===`, except that | ||
* `NaN` matches `NaN`. | ||
* | ||
@@ -28,2 +28,3 @@ * @static | ||
* @param {number} [fromIndex=0] The index to search from. | ||
* @param- {Object} [guard] Enables use as a callback for functions like `_.reduce`. | ||
* @returns {boolean} Returns `true` if a matching element is found, else `false`. | ||
@@ -44,3 +45,3 @@ * @example | ||
*/ | ||
function includes(collection, target, fromIndex) { | ||
function includes(collection, target, fromIndex, guard) { | ||
var length = collection ? collection.length : 0; | ||
@@ -54,6 +55,6 @@ if (!isLength(length)) { | ||
} | ||
if (typeof fromIndex == 'number') { | ||
if (typeof fromIndex != 'number' || (guard && isIterateeCall(target, fromIndex, guard))) { | ||
fromIndex = 0; | ||
} else { | ||
fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : (fromIndex || 0); | ||
} else { | ||
fromIndex = 0; | ||
} | ||
@@ -60,0 +61,0 @@ return (typeof collection == 'string' || !isArray(collection) && isString(collection)) |
@@ -7,6 +7,6 @@ var createAggregator = require('../internal/createAggregator'); | ||
* of each key is the last element responsible for generating the key. The | ||
* iteratee function is bound to `thisArg` and invoked with three arguments; | ||
* iteratee function is bound to `thisArg` and invoked with three arguments: | ||
* (value, index|key, collection). | ||
* | ||
* If a property name is provided for `predicate` the created `_.property` | ||
* If a property name is provided for `iteratee` the created `_.property` | ||
* style callback returns the property value of the given element. | ||
@@ -18,3 +18,3 @@ * | ||
* | ||
* If an object is provided for `predicate` the created `_.matches` style | ||
* If an object is provided for `iteratee` the created `_.matches` style | ||
* callback returns `true` for elements that have the properties of the given | ||
@@ -21,0 +21,0 @@ * object, else `false`. |
@@ -1,3 +0,4 @@ | ||
var baseInvoke = require('../internal/baseInvoke'), | ||
baseSlice = require('../internal/baseSlice'); | ||
var baseEach = require('../internal/baseEach'), | ||
isLength = require('../internal/isLength'), | ||
restParam = require('../function/restParam'); | ||
@@ -26,6 +27,15 @@ /** | ||
*/ | ||
function invoke(collection, methodName) { | ||
return baseInvoke(collection, methodName, baseSlice(arguments, 2)); | ||
} | ||
var invoke = restParam(function(collection, methodName, args) { | ||
var index = -1, | ||
isFunc = typeof methodName == 'function', | ||
length = collection ? collection.length : 0, | ||
result = isLength(length) ? Array(length) : []; | ||
baseEach(collection, function(value) { | ||
var func = isFunc ? methodName : (value != null && value[methodName]); | ||
result[++index] = func ? func.apply(value, args) : undefined; | ||
}); | ||
return result; | ||
}); | ||
module.exports = invoke; |
@@ -9,5 +9,5 @@ var arrayMap = require('../internal/arrayMap'), | ||
* `iteratee`. The `iteratee` is bound to `thisArg` and invoked with three | ||
* arguments; (value, index|key, collection). | ||
* arguments: (value, index|key, collection). | ||
* | ||
* If a property name is provided for `predicate` the created `_.property` | ||
* If a property name is provided for `iteratee` the created `_.property` | ||
* style callback returns the property value of the given element. | ||
@@ -19,3 +19,3 @@ * | ||
* | ||
* If an object is provided for `predicate` the created `_.matches` style | ||
* If an object is provided for `iteratee` the created `_.matches` style | ||
* callback returns `true` for elements that have the properties of the given | ||
@@ -29,5 +29,5 @@ * object, else `false`. | ||
* `ary`, `callback`, `chunk`, `clone`, `create`, `curry`, `curryRight`, `drop`, | ||
* `dropRight`, `fill`, `flatten`, `invert`, `max`, `min`, `parseInt`, `slice`, | ||
* `sortBy`, `take`, `takeRight`, `template`, `trim`, `trimLeft`, `trimRight`, | ||
* `trunc`, `random`, `range`, `sample`, `uniq`, and `words` | ||
* `dropRight`, `every`, `fill`, `flatten`, `invert`, `max`, `min`, `parseInt`, | ||
* `slice`, `sortBy`, `take`, `takeRight`, `template`, `trim`, `trimLeft`, | ||
* `trimRight`, `trunc`, `random`, `range`, `sample`, `some`, `uniq`, and `words` | ||
* | ||
@@ -34,0 +34,0 @@ * @static |
@@ -7,3 +7,3 @@ var createAggregator = require('../internal/createAggregator'); | ||
* contains elements `predicate` returns falsey for. The predicate is bound | ||
* to `thisArg` and invoked with three arguments; (value, index|key, collection). | ||
* to `thisArg` and invoked with three arguments: (value, index|key, collection). | ||
* | ||
@@ -10,0 +10,0 @@ * If a property name is provided for `predicate` the created `_.property` |
var arrayReduce = require('../internal/arrayReduce'), | ||
baseCallback = require('../internal/baseCallback'), | ||
baseEach = require('../internal/baseEach'), | ||
baseReduce = require('../internal/baseReduce'), | ||
isArray = require('../lang/isArray'); | ||
createReduce = require('../internal/createReduce'); | ||
@@ -12,3 +10,3 @@ /** | ||
* is not provided the first element of `collection` is used as the initial | ||
* value. The `iteratee` is bound to `thisArg`and invoked with four arguments; | ||
* value. The `iteratee` is bound to `thisArg` and invoked with four arguments: | ||
* (accumulator, value, index|key, collection). | ||
@@ -20,3 +18,3 @@ * | ||
* The guarded methods are: | ||
* `assign`, `defaults`, `merge`, and `sortAllBy` | ||
* `assign`, `defaults`, `includes`, `merge`, `sortByAll`, and `sortByOrder` | ||
* | ||
@@ -45,7 +43,4 @@ * @static | ||
*/ | ||
function reduce(collection, iteratee, accumulator, thisArg) { | ||
var func = isArray(collection) ? arrayReduce : baseReduce; | ||
return func(collection, baseCallback(iteratee, thisArg, 4), accumulator, arguments.length < 3, baseEach); | ||
} | ||
var reduce = createReduce(arrayReduce, baseEach); | ||
module.exports = reduce; |
var arrayReduceRight = require('../internal/arrayReduceRight'), | ||
baseCallback = require('../internal/baseCallback'), | ||
baseEachRight = require('../internal/baseEachRight'), | ||
baseReduce = require('../internal/baseReduce'), | ||
isArray = require('../lang/isArray'); | ||
createReduce = require('../internal/createReduce'); | ||
@@ -29,7 +27,4 @@ /** | ||
*/ | ||
function reduceRight(collection, iteratee, accumulator, thisArg) { | ||
var func = isArray(collection) ? arrayReduceRight : baseReduce; | ||
return func(collection, baseCallback(iteratee, thisArg, 4), accumulator, arguments.length < 3, baseEachRight); | ||
} | ||
var reduceRight = createReduce(arrayReduceRight, baseEachRight); | ||
module.exports = reduceRight; |
@@ -5,5 +5,4 @@ var baseRandom = require('../internal/baseRandom'), | ||
/** | ||
* Creates an array of shuffled values, using a version of the Fisher-Yates | ||
* shuffle. See [Wikipedia](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle) | ||
* for more details. | ||
* Creates an array of shuffled values, using a version of the | ||
* [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle). | ||
* | ||
@@ -10,0 +9,0 @@ * @static |
var arraySome = require('../internal/arraySome'), | ||
baseCallback = require('../internal/baseCallback'), | ||
baseSome = require('../internal/baseSome'), | ||
isArray = require('../lang/isArray'); | ||
isArray = require('../lang/isArray'), | ||
isIterateeCall = require('../internal/isIterateeCall'); | ||
@@ -10,3 +11,3 @@ /** | ||
* over the entire collection. The predicate is bound to `thisArg` and invoked | ||
* with three arguments; (value, index|key, collection). | ||
* with three arguments: (value, index|key, collection). | ||
* | ||
@@ -58,2 +59,5 @@ * If a property name is provided for `predicate` the created `_.property` | ||
var func = isArray(collection) ? arraySome : baseSome; | ||
if (thisArg && isIterateeCall(collection, predicate, thisArg)) { | ||
predicate = null; | ||
} | ||
if (typeof predicate != 'function' || typeof thisArg != 'undefined') { | ||
@@ -60,0 +64,0 @@ predicate = baseCallback(predicate, thisArg, 3); |
@@ -12,6 +12,6 @@ var baseCallback = require('../internal/baseCallback'), | ||
* a stable sort, that is, it preserves the original sort order of equal elements. | ||
* The `iteratee` is bound to `thisArg` and invoked with three arguments; | ||
* The `iteratee` is bound to `thisArg` and invoked with three arguments: | ||
* (value, index|key, collection). | ||
* | ||
* If a property name is provided for `predicate` the created `_.property` | ||
* If a property name is provided for `iteratee` the created `_.property` | ||
* style callback returns the property value of the given element. | ||
@@ -23,3 +23,3 @@ * | ||
* | ||
* If an object is provided for `predicate` the created `_.matches` style | ||
* If an object is provided for `iteratee` the created `_.matches` style | ||
* callback returns `true` for elements that have the properties of the given | ||
@@ -26,0 +26,0 @@ * object, else `false`. |
@@ -28,15 +28,22 @@ var baseFlatten = require('../internal/baseFlatten'), | ||
*/ | ||
function sortByAll(collection) { | ||
function sortByAll() { | ||
var args = arguments, | ||
collection = args[0], | ||
guard = args[3], | ||
index = 0, | ||
length = args.length - 1; | ||
if (collection == null) { | ||
return []; | ||
} | ||
var args = arguments, | ||
guard = args[3]; | ||
var props = Array(length); | ||
while (index < length) { | ||
props[index] = args[++index]; | ||
} | ||
if (guard && isIterateeCall(args[1], args[2], guard)) { | ||
args = [collection, args[1]]; | ||
props = args[1]; | ||
} | ||
return baseSortByOrder(collection, baseFlatten(args, false, false, 1), []); | ||
return baseSortByOrder(collection, baseFlatten(props), []); | ||
} | ||
module.exports = sortByAll; |
@@ -23,2 +23,3 @@ module.exports = { | ||
'rearg': require('./function/rearg'), | ||
'restParam': require('./function/restParam'), | ||
'spread': require('./function/spread'), | ||
@@ -25,0 +26,0 @@ 'throttle': require('./function/throttle'), |
@@ -5,3 +5,3 @@ var createWrapper = require('../internal/createWrapper'), | ||
/** Used to compose bitmasks for wrapper metadata. */ | ||
var ARY_FLAG = 256; | ||
var ARY_FLAG = 128; | ||
@@ -8,0 +8,0 @@ /* Native method references for those with the same name as other `lodash` methods. */ |
@@ -1,4 +0,4 @@ | ||
var baseSlice = require('../internal/baseSlice'), | ||
createWrapper = require('../internal/createWrapper'), | ||
replaceHolders = require('../internal/replaceHolders'); | ||
var createWrapper = require('../internal/createWrapper'), | ||
replaceHolders = require('../internal/replaceHolders'), | ||
restParam = require('./restParam'); | ||
@@ -25,3 +25,3 @@ /** Used to compose bitmasks for wrapper metadata. */ | ||
* @param {*} thisArg The `this` binding of `func`. | ||
* @param {...*} [args] The arguments to be partially applied. | ||
* @param {...*} [partials] The arguments to be partially applied. | ||
* @returns {Function} Returns the new bound function. | ||
@@ -45,12 +45,10 @@ * @example | ||
*/ | ||
function bind(func, thisArg) { | ||
var bind = restParam(function(func, thisArg, partials) { | ||
var bitmask = BIND_FLAG; | ||
if (arguments.length > 2) { | ||
var partials = baseSlice(arguments, 2), | ||
holders = replaceHolders(partials, bind.placeholder); | ||
if (partials.length) { | ||
var holders = replaceHolders(partials, bind.placeholder); | ||
bitmask |= PARTIAL_FLAG; | ||
} | ||
return createWrapper(func, bitmask, thisArg, partials, holders); | ||
} | ||
}); | ||
@@ -57,0 +55,0 @@ // Assign default placeholders. |
@@ -1,5 +0,9 @@ | ||
var baseBindAll = require('../internal/baseBindAll'), | ||
baseFlatten = require('../internal/baseFlatten'), | ||
functions = require('../object/functions'); | ||
var baseFlatten = require('../internal/baseFlatten'), | ||
createWrapper = require('../internal/createWrapper'), | ||
functions = require('../object/functions'), | ||
restParam = require('./restParam'); | ||
/** Used to compose bitmasks for wrapper metadata. */ | ||
var BIND_FLAG = 1; | ||
/** | ||
@@ -33,10 +37,15 @@ * Binds methods of an object to the object itself, overwriting the existing | ||
*/ | ||
function bindAll(object) { | ||
return baseBindAll(object, | ||
arguments.length > 1 | ||
? baseFlatten(arguments, false, false, 1) | ||
: functions(object) | ||
); | ||
} | ||
var bindAll = restParam(function(object, methodNames) { | ||
methodNames = methodNames.length ? baseFlatten(methodNames) : functions(object); | ||
var index = -1, | ||
length = methodNames.length; | ||
while (++index < length) { | ||
var key = methodNames[index]; | ||
object[key] = createWrapper(object[key], BIND_FLAG, object); | ||
} | ||
return object; | ||
}); | ||
module.exports = bindAll; |
@@ -1,4 +0,4 @@ | ||
var baseSlice = require('../internal/baseSlice'), | ||
createWrapper = require('../internal/createWrapper'), | ||
replaceHolders = require('../internal/replaceHolders'); | ||
var createWrapper = require('../internal/createWrapper'), | ||
replaceHolders = require('../internal/replaceHolders'), | ||
restParam = require('./restParam'); | ||
@@ -27,3 +27,3 @@ /** Used to compose bitmasks for wrapper metadata. */ | ||
* @param {string} key The key of the method. | ||
* @param {...*} [args] The arguments to be partially applied. | ||
* @param {...*} [partials] The arguments to be partially applied. | ||
* @returns {Function} Returns the new bound function. | ||
@@ -55,12 +55,10 @@ * @example | ||
*/ | ||
function bindKey(object, key) { | ||
var bindKey = restParam(function(object, key, partials) { | ||
var bitmask = BIND_FLAG | BIND_KEY_FLAG; | ||
if (arguments.length > 2) { | ||
var partials = baseSlice(arguments, 2), | ||
holders = replaceHolders(partials, bindKey.placeholder); | ||
if (partials.length) { | ||
var holders = replaceHolders(partials, bindKey.placeholder); | ||
bitmask |= PARTIAL_FLAG; | ||
} | ||
return createWrapper(key, bitmask, object, partials, holders); | ||
} | ||
}); | ||
@@ -67,0 +65,0 @@ // Assign default placeholders. |
@@ -1,3 +0,2 @@ | ||
var createWrapper = require('../internal/createWrapper'), | ||
isIterateeCall = require('../internal/isIterateeCall'); | ||
var createCurry = require('../internal/createCurry'); | ||
@@ -47,10 +46,3 @@ /** Used to compose bitmasks for wrapper metadata. */ | ||
*/ | ||
function curry(func, arity, guard) { | ||
if (guard && isIterateeCall(func, arity, guard)) { | ||
arity = null; | ||
} | ||
var result = createWrapper(func, CURRY_FLAG, null, null, null, null, null, arity); | ||
result.placeholder = curry.placeholder; | ||
return result; | ||
} | ||
var curry = createCurry(CURRY_FLAG); | ||
@@ -57,0 +49,0 @@ // Assign default placeholders. |
@@ -1,3 +0,2 @@ | ||
var createWrapper = require('../internal/createWrapper'), | ||
isIterateeCall = require('../internal/isIterateeCall'); | ||
var createCurry = require('../internal/createCurry'); | ||
@@ -44,10 +43,3 @@ /** Used to compose bitmasks for wrapper metadata. */ | ||
*/ | ||
function curryRight(func, arity, guard) { | ||
if (guard && isIterateeCall(func, arity, guard)) { | ||
arity = null; | ||
} | ||
var result = createWrapper(func, CURRY_RIGHT_FLAG, null, null, null, null, null, arity); | ||
result.placeholder = curryRight.placeholder; | ||
return result; | ||
} | ||
var curryRight = createCurry(CURRY_RIGHT_FLAG); | ||
@@ -54,0 +46,0 @@ // Assign default placeholders. |
@@ -1,2 +0,3 @@ | ||
var baseDelay = require('../internal/baseDelay'); | ||
var baseDelay = require('../internal/baseDelay'), | ||
restParam = require('./restParam'); | ||
@@ -20,6 +21,6 @@ /** | ||
*/ | ||
function defer(func) { | ||
return baseDelay(func, 1, arguments, 1); | ||
} | ||
var defer = restParam(function(func, args) { | ||
return baseDelay(func, 1, args); | ||
}); | ||
module.exports = defer; |
@@ -1,2 +0,3 @@ | ||
var baseDelay = require('../internal/baseDelay'); | ||
var baseDelay = require('../internal/baseDelay'), | ||
restParam = require('./restParam'); | ||
@@ -21,6 +22,6 @@ /** | ||
*/ | ||
function delay(func, wait) { | ||
return baseDelay(func, wait, arguments, 2); | ||
} | ||
var delay = restParam(function(func, wait, args) { | ||
return baseDelay(func, wait, args); | ||
}); | ||
module.exports = delay; |
@@ -1,2 +0,2 @@ | ||
var createComposer = require('../internal/createComposer'); | ||
var createFlow = require('../internal/createFlow'); | ||
@@ -23,4 +23,4 @@ /** | ||
*/ | ||
var flow = createComposer(); | ||
var flow = createFlow(); | ||
module.exports = flow; |
@@ -1,2 +0,2 @@ | ||
var createComposer = require('../internal/createComposer'); | ||
var createFlow = require('../internal/createFlow'); | ||
@@ -23,4 +23,4 @@ /** | ||
*/ | ||
var flowRight = createComposer(true); | ||
var flowRight = createFlow(true); | ||
module.exports = flowRight; |
@@ -16,6 +16,4 @@ var MapCache = require('../internal/MapCache'); | ||
* function. Its creation may be customized by replacing the `_.memoize.Cache` | ||
* constructor with one whose instances implement the ES `Map` method interface | ||
* of `get`, `has`, and `set`. See the | ||
* [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-map-prototype-object) | ||
* for more details. | ||
* constructor with one whose instances implement the [`Map`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-map-prototype-object) | ||
* method interface of `get`, `has`, and `set`. | ||
* | ||
@@ -22,0 +20,0 @@ * @static |
@@ -6,3 +6,3 @@ var before = require('./before'); | ||
* to the function return the value of the first call. The `func` is invoked | ||
* with the `this` binding of the created function. | ||
* with the `this` binding and arguments of the created function. | ||
* | ||
@@ -9,0 +9,0 @@ * @static |
@@ -1,4 +0,2 @@ | ||
var baseSlice = require('../internal/baseSlice'), | ||
createWrapper = require('../internal/createWrapper'), | ||
replaceHolders = require('../internal/replaceHolders'); | ||
var createPartial = require('../internal/createPartial'); | ||
@@ -23,3 +21,3 @@ /** Used to compose bitmasks for wrapper metadata. */ | ||
* @param {Function} func The function to partially apply arguments to. | ||
* @param {...*} [args] The arguments to be partially applied. | ||
* @param {...*} [partials] The arguments to be partially applied. | ||
* @returns {Function} Returns the new partially applied function. | ||
@@ -41,9 +39,4 @@ * @example | ||
*/ | ||
function partial(func) { | ||
var partials = baseSlice(arguments, 1), | ||
holders = replaceHolders(partials, partial.placeholder); | ||
var partial = createPartial(PARTIAL_FLAG); | ||
return createWrapper(func, PARTIAL_FLAG, null, partials, holders); | ||
} | ||
// Assign default placeholders. | ||
@@ -50,0 +43,0 @@ partial.placeholder = {}; |
@@ -1,4 +0,2 @@ | ||
var baseSlice = require('../internal/baseSlice'), | ||
createWrapper = require('../internal/createWrapper'), | ||
replaceHolders = require('../internal/replaceHolders'); | ||
var createPartial = require('../internal/createPartial'); | ||
@@ -22,3 +20,3 @@ /** Used to compose bitmasks for wrapper metadata. */ | ||
* @param {Function} func The function to partially apply arguments to. | ||
* @param {...*} [args] The arguments to be partially applied. | ||
* @param {...*} [partials] The arguments to be partially applied. | ||
* @returns {Function} Returns the new partially applied function. | ||
@@ -40,9 +38,4 @@ * @example | ||
*/ | ||
function partialRight(func) { | ||
var partials = baseSlice(arguments, 1), | ||
holders = replaceHolders(partials, partialRight.placeholder); | ||
var partialRight = createPartial(PARTIAL_RIGHT_FLAG); | ||
return createWrapper(func, PARTIAL_RIGHT_FLAG, null, partials, holders); | ||
} | ||
// Assign default placeholders. | ||
@@ -49,0 +42,0 @@ partialRight.placeholder = {}; |
var baseFlatten = require('../internal/baseFlatten'), | ||
createWrapper = require('../internal/createWrapper'); | ||
createWrapper = require('../internal/createWrapper'), | ||
restParam = require('./restParam'); | ||
/** Used to compose bitmasks for wrapper metadata. */ | ||
var REARG_FLAG = 128; | ||
var REARG_FLAG = 256; | ||
@@ -35,7 +36,6 @@ /** | ||
*/ | ||
function rearg(func) { | ||
var indexes = baseFlatten(arguments, false, false, 1); | ||
return createWrapper(func, REARG_FLAG, null, null, null, indexes); | ||
} | ||
var rearg = restParam(function(func, indexes) { | ||
return createWrapper(func, REARG_FLAG, null, null, null, baseFlatten(indexes)); | ||
}); | ||
module.exports = rearg; |
@@ -5,6 +5,7 @@ /** Used as the `TypeError` message for "Functions" methods. */ | ||
/** | ||
* Creates a function that invokes `func` with the `this` binding of the | ||
* created function and the array of arguments provided to the created | ||
* function much like [Function#apply](http://es5.github.io/#x15.3.4.3). | ||
* Creates a function that invokes `func` with the `this` binding of the created | ||
* function and an array of arguments much like [`Function#apply`](https://es5.github.io/#x15.3.4.3). | ||
* | ||
* **Note:** This method is based on the [spread operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_operator). | ||
* | ||
* @static | ||
@@ -14,11 +15,11 @@ * @memberOf _ | ||
* @param {Function} func The function to spread arguments over. | ||
* @returns {*} Returns the new function. | ||
* @returns {Function} Returns the new function. | ||
* @example | ||
* | ||
* var spread = _.spread(function(who, what) { | ||
* var say = _.spread(function(who, what) { | ||
* return who + ' says ' + what; | ||
* }); | ||
* | ||
* spread(['Fred', 'hello']); | ||
* // => 'Fred says hello' | ||
* say(['fred', 'hello']); | ||
* // => 'fred says hello' | ||
* | ||
@@ -25,0 +26,0 @@ * // with a Promise |
/** | ||
* A specialized version of `_.forEach` for arrays without support for callback | ||
* shorthands or `this` binding. | ||
* shorthands and `this` binding. | ||
* | ||
@@ -5,0 +5,0 @@ * @private |
/** | ||
* A specialized version of `_.forEachRight` for arrays without support for | ||
* callback shorthands or `this` binding. | ||
* callback shorthands and `this` binding. | ||
* | ||
@@ -5,0 +5,0 @@ * @private |
/** | ||
* A specialized version of `_.every` for arrays without support for callback | ||
* shorthands or `this` binding. | ||
* shorthands and `this` binding. | ||
* | ||
@@ -5,0 +5,0 @@ * @private |
/** | ||
* A specialized version of `_.filter` for arrays without support for callback | ||
* shorthands or `this` binding. | ||
* shorthands and `this` binding. | ||
* | ||
@@ -5,0 +5,0 @@ * @private |
/** | ||
* A specialized version of `_.map` for arrays without support for callback | ||
* shorthands or `this` binding. | ||
* shorthands and `this` binding. | ||
* | ||
@@ -5,0 +5,0 @@ * @private |
/** | ||
* A specialized version of `_.reduce` for arrays without support for callback | ||
* shorthands or `this` binding. | ||
* shorthands and `this` binding. | ||
* | ||
@@ -5,0 +5,0 @@ * @private |
/** | ||
* A specialized version of `_.reduceRight` for arrays without support for | ||
* callback shorthands or `this` binding. | ||
* callback shorthands and `this` binding. | ||
* | ||
@@ -5,0 +5,0 @@ * @private |
/** | ||
* A specialized version of `_.some` for arrays without support for callback | ||
* shorthands or `this` binding. | ||
* shorthands and `this` binding. | ||
* | ||
@@ -5,0 +5,0 @@ * @private |
@@ -5,4 +5,3 @@ var baseMatches = require('./baseMatches'), | ||
bindCallback = require('./bindCallback'), | ||
identity = require('../utility/identity'), | ||
isBindable = require('./isBindable'); | ||
identity = require('../utility/identity'); | ||
@@ -22,5 +21,5 @@ /** | ||
if (type == 'function') { | ||
return (typeof thisArg != 'undefined' && isBindable(func)) | ||
? bindCallback(func, thisArg, argCount) | ||
: func; | ||
return typeof thisArg == 'undefined' | ||
? func | ||
: bindCallback(func, thisArg, argCount); | ||
} | ||
@@ -27,0 +26,0 @@ if (func == null) { |
@@ -57,5 +57,4 @@ var arrayCopy = require('./arrayCopy'), | ||
/** | ||
* Used to resolve the `toStringTag` of values. | ||
* See the [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) | ||
* for more details. | ||
* Used to resolve the [`toStringTag`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) | ||
* of values. | ||
*/ | ||
@@ -62,0 +61,0 @@ var objToString = objectProto.toString; |
@@ -1,3 +0,1 @@ | ||
var baseSlice = require('./baseSlice'); | ||
/** Used as the `TypeError` message for "Functions" methods. */ | ||
@@ -13,12 +11,12 @@ var FUNC_ERROR_TEXT = 'Expected a function'; | ||
* @param {number} wait The number of milliseconds to delay invocation. | ||
* @param {Object} args The `arguments` object to slice and provide to `func`. | ||
* @param {Object} args The arguments provide to `func`. | ||
* @returns {number} Returns the timer id. | ||
*/ | ||
function baseDelay(func, wait, args, fromIndex) { | ||
function baseDelay(func, wait, args) { | ||
if (typeof func != 'function') { | ||
throw new TypeError(FUNC_ERROR_TEXT); | ||
} | ||
return setTimeout(function() { func.apply(undefined, baseSlice(args, fromIndex)); }, wait); | ||
return setTimeout(function() { func.apply(undefined, args); }, wait); | ||
} | ||
module.exports = baseDelay; |
var baseForOwn = require('./baseForOwn'), | ||
isLength = require('./isLength'), | ||
toObject = require('./toObject'); | ||
createBaseEach = require('./createBaseEach'); | ||
@@ -14,18 +13,4 @@ /** | ||
*/ | ||
function baseEach(collection, iteratee) { | ||
var length = collection ? collection.length : 0; | ||
if (!isLength(length)) { | ||
return baseForOwn(collection, iteratee); | ||
} | ||
var index = -1, | ||
iterable = toObject(collection); | ||
var baseEach = createBaseEach(baseForOwn); | ||
while (++index < length) { | ||
if (iteratee(iterable[index], index, iterable) === false) { | ||
break; | ||
} | ||
} | ||
return collection; | ||
} | ||
module.exports = baseEach; |
var baseForOwnRight = require('./baseForOwnRight'), | ||
isLength = require('./isLength'), | ||
toObject = require('./toObject'); | ||
createBaseEach = require('./createBaseEach'); | ||
@@ -14,16 +13,4 @@ /** | ||
*/ | ||
function baseEachRight(collection, iteratee) { | ||
var length = collection ? collection.length : 0; | ||
if (!isLength(length)) { | ||
return baseForOwnRight(collection, iteratee); | ||
} | ||
var iterable = toObject(collection); | ||
while (length--) { | ||
if (iteratee(iterable[length], length, iterable) === false) { | ||
break; | ||
} | ||
} | ||
return collection; | ||
} | ||
var baseEachRight = createBaseEach(baseForOwnRight, true); | ||
module.exports = baseEachRight; |
@@ -5,3 +5,3 @@ var baseEach = require('./baseEach'); | ||
* The base implementation of `_.every` without support for callback | ||
* shorthands or `this` binding. | ||
* shorthands and `this` binding. | ||
* | ||
@@ -8,0 +8,0 @@ * @private |
@@ -5,3 +5,3 @@ var baseEach = require('./baseEach'); | ||
* The base implementation of `_.filter` without support for callback | ||
* shorthands or `this` binding. | ||
* shorthands and `this` binding. | ||
* | ||
@@ -8,0 +8,0 @@ * @private |
@@ -14,7 +14,6 @@ var isArguments = require('../lang/isArguments'), | ||
* @param {boolean} isStrict Restrict flattening to arrays and `arguments` objects. | ||
* @param {number} fromIndex The index to start from. | ||
* @returns {Array} Returns the new flattened array. | ||
*/ | ||
function baseFlatten(array, isDeep, isStrict, fromIndex) { | ||
var index = fromIndex - 1, | ||
function baseFlatten(array, isDeep, isStrict) { | ||
var index = -1, | ||
length = array.length, | ||
@@ -30,3 +29,3 @@ resIndex = -1, | ||
// Recursively flatten arrays (susceptible to call stack limits). | ||
value = baseFlatten(value, isDeep, isStrict, 0); | ||
value = baseFlatten(value, isDeep, isStrict); | ||
} | ||
@@ -33,0 +32,0 @@ var valIndex = -1, |
@@ -1,2 +0,2 @@ | ||
var toObject = require('./toObject'); | ||
var createBaseFor = require('./createBaseFor'); | ||
@@ -15,17 +15,4 @@ /** | ||
*/ | ||
function baseFor(object, iteratee, keysFunc) { | ||
var index = -1, | ||
iterable = toObject(object), | ||
props = keysFunc(object), | ||
length = props.length; | ||
var baseFor = createBaseFor(); | ||
while (++index < length) { | ||
var key = props[index]; | ||
if (iteratee(iterable[key], key, iterable) === false) { | ||
break; | ||
} | ||
} | ||
return object; | ||
} | ||
module.exports = baseFor; |
@@ -1,2 +0,2 @@ | ||
var toObject = require('./toObject'); | ||
var createBaseFor = require('./createBaseFor'); | ||
@@ -13,16 +13,4 @@ /** | ||
*/ | ||
function baseForRight(object, iteratee, keysFunc) { | ||
var iterable = toObject(object), | ||
props = keysFunc(object), | ||
length = props.length; | ||
var baseForRight = createBaseFor(true); | ||
while (length--) { | ||
var key = props[length]; | ||
if (iteratee(iterable[key], key, iterable) === false) { | ||
break; | ||
} | ||
} | ||
return object; | ||
} | ||
module.exports = baseForRight; |
@@ -11,3 +11,3 @@ var baseIsEqualDeep = require('./baseIsEqualDeep'); | ||
* @param {Function} [customizer] The function to customize comparing values. | ||
* @param {boolean} [isWhere] Specify performing partial comparisons. | ||
* @param {boolean} [isLoose] Specify performing partial comparisons. | ||
* @param {Array} [stackA] Tracks traversed `value` objects. | ||
@@ -17,3 +17,3 @@ * @param {Array} [stackB] Tracks traversed `other` objects. | ||
*/ | ||
function baseIsEqual(value, other, customizer, isWhere, stackA, stackB) { | ||
function baseIsEqual(value, other, customizer, isLoose, stackA, stackB) { | ||
// Exit early for identical values. | ||
@@ -33,5 +33,5 @@ if (value === other) { | ||
} | ||
return baseIsEqualDeep(value, other, baseIsEqual, customizer, isWhere, stackA, stackB); | ||
return baseIsEqualDeep(value, other, baseIsEqual, customizer, isLoose, stackA, stackB); | ||
} | ||
module.exports = baseIsEqual; |
@@ -10,2 +10,3 @@ var equalArrays = require('./equalArrays'), | ||
arrayTag = '[object Array]', | ||
funcTag = '[object Function]', | ||
objectTag = '[object Object]'; | ||
@@ -20,5 +21,4 @@ | ||
/** | ||
* Used to resolve the `toStringTag` of values. | ||
* See the [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) | ||
* for more details. | ||
* Used to resolve the [`toStringTag`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) | ||
* of values. | ||
*/ | ||
@@ -37,3 +37,3 @@ var objToString = objectProto.toString; | ||
* @param {Function} [customizer] The function to customize comparing objects. | ||
* @param {boolean} [isWhere] Specify performing partial comparisons. | ||
* @param {boolean} [isLoose] Specify performing partial comparisons. | ||
* @param {Array} [stackA=[]] Tracks traversed `value` objects. | ||
@@ -43,3 +43,3 @@ * @param {Array} [stackB=[]] Tracks traversed `other` objects. | ||
*/ | ||
function baseIsEqualDeep(object, other, equalFunc, customizer, isWhere, stackA, stackB) { | ||
function baseIsEqualDeep(object, other, equalFunc, customizer, isLoose, stackA, stackB) { | ||
var objIsArr = isArray(object), | ||
@@ -66,4 +66,4 @@ othIsArr = isArray(other), | ||
} | ||
var objIsObj = objTag == objectTag, | ||
othIsObj = othTag == objectTag, | ||
var objIsObj = (objTag == objectTag || (isLoose && objTag == funcTag)), | ||
othIsObj = (othTag == objectTag || (isLoose && othTag == funcTag)), | ||
isSameTag = objTag == othTag; | ||
@@ -74,11 +74,17 @@ | ||
} | ||
var valWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), | ||
othWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); | ||
if (isLoose) { | ||
if (!isSameTag && !(objIsObj && othIsObj)) { | ||
return false; | ||
} | ||
} else { | ||
var valWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), | ||
othWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); | ||
if (valWrapped || othWrapped) { | ||
return equalFunc(valWrapped ? object.value() : object, othWrapped ? other.value() : other, customizer, isWhere, stackA, stackB); | ||
if (valWrapped || othWrapped) { | ||
return equalFunc(valWrapped ? object.value() : object, othWrapped ? other.value() : other, customizer, isLoose, stackA, stackB); | ||
} | ||
if (!isSameTag) { | ||
return false; | ||
} | ||
} | ||
if (!isSameTag) { | ||
return false; | ||
} | ||
// Assume cyclic values are equal. | ||
@@ -99,3 +105,3 @@ // For more information on detecting circular references see https://es5.github.io/#JO. | ||
var result = (objIsArr ? equalArrays : equalObjects)(object, other, equalFunc, customizer, isWhere, stackA, stackB); | ||
var result = (objIsArr ? equalArrays : equalObjects)(object, other, equalFunc, customizer, isLoose, stackA, stackB); | ||
@@ -102,0 +108,0 @@ stackA.pop(); |
var baseIsEqual = require('./baseIsEqual'); | ||
/** Used for native method references. */ | ||
var objectProto = Object.prototype; | ||
/** Used to check objects for own properties. */ | ||
var hasOwnProperty = objectProto.hasOwnProperty; | ||
/** | ||
* The base implementation of `_.isMatch` without support for callback | ||
* shorthands or `this` binding. | ||
* shorthands and `this` binding. | ||
* | ||
@@ -22,7 +16,4 @@ * @private | ||
function baseIsMatch(object, props, values, strictCompareFlags, customizer) { | ||
var length = props.length; | ||
if (object == null) { | ||
return !length; | ||
} | ||
var index = -1, | ||
length = props.length, | ||
noCustomizer = !customizer; | ||
@@ -33,3 +24,3 @@ | ||
? values[index] !== object[props[index]] | ||
: !hasOwnProperty.call(object, props[index]) | ||
: !(props[index] in object) | ||
) { | ||
@@ -41,9 +32,9 @@ return false; | ||
while (++index < length) { | ||
var key = props[index]; | ||
var key = props[index], | ||
objValue = object[key], | ||
srcValue = values[index]; | ||
if (noCustomizer && strictCompareFlags[index]) { | ||
var result = hasOwnProperty.call(object, key); | ||
var result = typeof objValue != 'undefined' || (key in object); | ||
} else { | ||
var objValue = object[key], | ||
srcValue = values[index]; | ||
result = customizer ? customizer(objValue, srcValue, key) : undefined; | ||
@@ -50,0 +41,0 @@ if (typeof result == 'undefined') { |
@@ -5,3 +5,3 @@ var baseEach = require('./baseEach'); | ||
* The base implementation of `_.map` without support for callback shorthands | ||
* or `this` binding. | ||
* and `this` binding. | ||
* | ||
@@ -8,0 +8,0 @@ * @private |
var baseIsMatch = require('./baseIsMatch'), | ||
constant = require('../utility/constant'), | ||
isStrictComparable = require('./isStrictComparable'), | ||
keys = require('../object/keys'); | ||
keys = require('../object/keys'), | ||
toObject = require('./toObject'); | ||
/** Used for native method references. */ | ||
var objectProto = Object.prototype; | ||
/** Used to check objects for own properties. */ | ||
var hasOwnProperty = objectProto.hasOwnProperty; | ||
/** | ||
@@ -22,2 +18,5 @@ * The base implementation of `_.matches` which does not clone `source`. | ||
if (!length) { | ||
return constant(true); | ||
} | ||
if (length == 1) { | ||
@@ -29,3 +28,4 @@ var key = props[0], | ||
return function(object) { | ||
return object != null && object[key] === value && hasOwnProperty.call(object, key); | ||
return object != null && object[key] === value && | ||
(typeof value != 'undefined' || (key in toObject(object))); | ||
}; | ||
@@ -43,3 +43,3 @@ } | ||
return function(object) { | ||
return baseIsMatch(object, props, values, strictCompareFlags); | ||
return object != null && baseIsMatch(toObject(object), props, values, strictCompareFlags); | ||
}; | ||
@@ -46,0 +46,0 @@ } |
var baseIsEqual = require('./baseIsEqual'), | ||
isStrictComparable = require('./isStrictComparable'); | ||
isStrictComparable = require('./isStrictComparable'), | ||
toObject = require('./toObject'); | ||
@@ -16,3 +17,4 @@ /** | ||
return function(object) { | ||
return object != null && object[key] === value; | ||
return object != null && object[key] === value && | ||
(typeof value != 'undefined' || (key in toObject(object))); | ||
}; | ||
@@ -19,0 +21,0 @@ } |
@@ -43,3 +43,3 @@ var arrayCopy = require('./arrayCopy'), | ||
? value | ||
: (value ? arrayCopy(value) : []); | ||
: ((value && value.length) ? arrayCopy(value) : []); | ||
} | ||
@@ -46,0 +46,0 @@ else if (isPlainObject(srcValue) || isArguments(srcValue)) { |
/** | ||
* The base implementation of `_.reduce` and `_.reduceRight` without support | ||
* for callback shorthands or `this` binding, which iterates over `collection` | ||
* for callback shorthands and `this` binding, which iterates over `collection` | ||
* using the provided `eachFunc`. | ||
@@ -5,0 +5,0 @@ * |
@@ -5,3 +5,3 @@ var baseEach = require('./baseEach'); | ||
* The base implementation of `_.some` without support for callback shorthands | ||
* or `this` binding. | ||
* and `this` binding. | ||
* | ||
@@ -8,0 +8,0 @@ * @private |
@@ -17,3 +17,3 @@ var LazyWrapper = require('./LazyWrapper'); | ||
* @param {Array} actions Actions to peform to resolve the unwrapped value. | ||
* @returns {*} Returns the resolved unwrapped value. | ||
* @returns {*} Returns the resolved value. | ||
*/ | ||
@@ -20,0 +20,0 @@ function baseWrapperValue(value, actions) { |
@@ -15,4 +15,3 @@ var binaryIndexBy = require('./binaryIndexBy'), | ||
* @param {*} value The value to evaluate. | ||
* @param {boolean} [retHighest] Specify returning the highest, instead | ||
* of the lowest, index at which a value should be inserted into `array`. | ||
* @param {boolean} [retHighest] Specify returning the highest qualified index. | ||
* @returns {number} Returns the index at which `value` should be inserted | ||
@@ -19,0 +18,0 @@ * into `array`. |
@@ -20,4 +20,3 @@ /** Native method references. */ | ||
* @param {Function} iteratee The function invoked per iteration. | ||
* @param {boolean} [retHighest] Specify returning the highest, instead | ||
* of the lowest, index at which a value should be inserted into `array`. | ||
* @param {boolean} [retHighest] Specify returning the highest qualified index. | ||
* @returns {number} Returns the index at which `value` should be inserted | ||
@@ -24,0 +23,0 @@ * into `array`. |
@@ -10,2 +10,5 @@ var baseCallback = require('./baseCallback'), | ||
* | ||
* **Note:** This function is used to create `_.countBy`, `_.groupBy`, `_.indexBy`, | ||
* and `_.partition`. | ||
* | ||
* @private | ||
@@ -12,0 +15,0 @@ * @param {Function} setter The function to set keys and values of the accumulator object. |
@@ -8,2 +8,4 @@ var bindCallback = require('./bindCallback'), | ||
* | ||
* **Note:** This function is used to create `_.assign`, `_.defaults`, and `_.merge`. | ||
* | ||
* @private | ||
@@ -10,0 +12,0 @@ * @param {Function} assigner The function to assign values. |
@@ -10,3 +10,3 @@ var baseCallback = require('./baseCallback'), | ||
/** | ||
* Creates a function that gets the extremum value of a collection. | ||
* Creates a `_.max` or `_.min` function. | ||
* | ||
@@ -13,0 +13,0 @@ * @private |
@@ -5,4 +5,6 @@ var arrayCopy = require('./arrayCopy'), | ||
createCtorWrapper = require('./createCtorWrapper'), | ||
isLaziable = require('./isLaziable'), | ||
reorder = require('./reorder'), | ||
replaceHolders = require('./replaceHolders'); | ||
replaceHolders = require('./replaceHolders'), | ||
setData = require('./setData'); | ||
@@ -17,3 +19,3 @@ /** Used to compose bitmasks for wrapper metadata. */ | ||
PARTIAL_RIGHT_FLAG = 64, | ||
ARY_FLAG = 256; | ||
ARY_FLAG = 128; | ||
@@ -86,3 +88,8 @@ /* Native method references for those with the same name as other `lodash` methods. */ | ||
} | ||
var result = createHybridWrapper(func, bitmask, thisArg, newPartials, newsHolders, newPartialsRight, newHoldersRight, newArgPos, ary, newArity); | ||
var newData = [func, bitmask, thisArg, newPartials, newsHolders, newPartialsRight, newHoldersRight, newArgPos, ary, newArity], | ||
result = createHybridWrapper.apply(undefined, newData); | ||
if (isLaziable(func)) { | ||
setData(result, newData); | ||
} | ||
result.placeholder = placeholder; | ||
@@ -89,0 +96,0 @@ return result; |
@@ -63,6 +63,6 @@ var baseSetData = require('./baseSetData'), | ||
} | ||
var data = !isBindKey && getData(func), | ||
var data = isBindKey ? null : getData(func), | ||
newData = [func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity]; | ||
if (data && data !== true) { | ||
if (data) { | ||
mergeData(newData, data); | ||
@@ -69,0 +69,0 @@ bitmask = newData[1]; |
@@ -10,3 +10,3 @@ /** | ||
* @param {Function} [customizer] The function to customize comparing arrays. | ||
* @param {boolean} [isWhere] Specify performing partial comparisons. | ||
* @param {boolean} [isLoose] Specify performing partial comparisons. | ||
* @param {Array} [stackA] Tracks traversed `value` objects. | ||
@@ -16,3 +16,3 @@ * @param {Array} [stackB] Tracks traversed `other` objects. | ||
*/ | ||
function equalArrays(array, other, equalFunc, customizer, isWhere, stackA, stackB) { | ||
function equalArrays(array, other, equalFunc, customizer, isLoose, stackA, stackB) { | ||
var index = -1, | ||
@@ -23,3 +23,3 @@ arrLength = array.length, | ||
if (arrLength != othLength && !(isWhere && othLength > arrLength)) { | ||
if (arrLength != othLength && !(isLoose && othLength > arrLength)) { | ||
return false; | ||
@@ -34,3 +34,3 @@ } | ||
if (customizer) { | ||
result = isWhere | ||
result = isLoose | ||
? customizer(othValue, arrValue, index) | ||
@@ -41,7 +41,7 @@ : customizer(arrValue, othValue, index); | ||
// Recursively compare arrays (susceptible to call stack limits). | ||
if (isWhere) { | ||
if (isLoose) { | ||
var othIndex = othLength; | ||
while (othIndex--) { | ||
othValue = other[othIndex]; | ||
result = (arrValue && arrValue === othValue) || equalFunc(arrValue, othValue, customizer, isWhere, stackA, stackB); | ||
result = (arrValue && arrValue === othValue) || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB); | ||
if (result) { | ||
@@ -52,3 +52,3 @@ break; | ||
} else { | ||
result = (arrValue && arrValue === othValue) || equalFunc(arrValue, othValue, customizer, isWhere, stackA, stackB); | ||
result = (arrValue && arrValue === othValue) || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB); | ||
} | ||
@@ -55,0 +55,0 @@ } |
@@ -18,3 +18,3 @@ var keys = require('../object/keys'); | ||
* @param {Function} [customizer] The function to customize comparing values. | ||
* @param {boolean} [isWhere] Specify performing partial comparisons. | ||
* @param {boolean} [isLoose] Specify performing partial comparisons. | ||
* @param {Array} [stackA] Tracks traversed `value` objects. | ||
@@ -24,3 +24,3 @@ * @param {Array} [stackB] Tracks traversed `other` objects. | ||
*/ | ||
function equalObjects(object, other, equalFunc, customizer, isWhere, stackA, stackB) { | ||
function equalObjects(object, other, equalFunc, customizer, isLoose, stackA, stackB) { | ||
var objProps = keys(object), | ||
@@ -31,6 +31,6 @@ objLength = objProps.length, | ||
if (objLength != othLength && !isWhere) { | ||
if (objLength != othLength && !isLoose) { | ||
return false; | ||
} | ||
var hasCtor, | ||
var skipCtor = isLoose, | ||
index = -1; | ||
@@ -40,3 +40,3 @@ | ||
var key = objProps[index], | ||
result = hasOwnProperty.call(other, key); | ||
result = isLoose ? key in other : hasOwnProperty.call(other, key); | ||
@@ -49,3 +49,3 @@ if (result) { | ||
if (customizer) { | ||
result = isWhere | ||
result = isLoose | ||
? customizer(othValue, objValue, key) | ||
@@ -56,3 +56,3 @@ : customizer(objValue, othValue, key); | ||
// Recursively compare objects (susceptible to call stack limits). | ||
result = (objValue && objValue === othValue) || equalFunc(objValue, othValue, customizer, isWhere, stackA, stackB); | ||
result = (objValue && objValue === othValue) || equalFunc(objValue, othValue, customizer, isLoose, stackA, stackB); | ||
} | ||
@@ -63,5 +63,5 @@ } | ||
} | ||
hasCtor || (hasCtor = key == 'constructor'); | ||
skipCtor || (skipCtor = key == 'constructor'); | ||
} | ||
if (!hasCtor) { | ||
if (!skipCtor) { | ||
var objCtor = object.constructor, | ||
@@ -68,0 +68,0 @@ othCtor = other.constructor; |
@@ -10,3 +10,3 @@ var baseEach = require('./baseEach'); | ||
* in `collection` to generate the criterion by which the value is ranked. | ||
* The `iteratee` is invoked with three arguments; (value, index, collection). | ||
* The `iteratee` is invoked with three arguments: (value, index, collection). | ||
* | ||
@@ -13,0 +13,0 @@ * @private |
/** | ||
* Gets the index at which the first occurrence of `NaN` is found in `array`. | ||
* If `fromRight` is provided elements of `array` are iterated from right to left. | ||
* | ||
@@ -5,0 +4,0 @@ * @private |
/** | ||
* Used as the maximum length of an array-like value. | ||
* See the [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.max_safe_integer) | ||
* for more details. | ||
* Used as the [maximum length](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.max_safe_integer) | ||
* of an array-like value. | ||
*/ | ||
@@ -6,0 +5,0 @@ var MAX_SAFE_INTEGER = Math.pow(2, 53) - 1; |
/** | ||
* Used as the maximum length of an array-like value. | ||
* See the [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.max_safe_integer) | ||
* for more details. | ||
* Used as the [maximum length](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.max_safe_integer) | ||
* of an array-like value. | ||
*/ | ||
@@ -11,5 +10,3 @@ var MAX_SAFE_INTEGER = Math.pow(2, 53) - 1; | ||
* | ||
* **Note:** This function is based on ES `ToLength`. See the | ||
* [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength) | ||
* for more details. | ||
* **Note:** This function is based on [`ToLength`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength). | ||
* | ||
@@ -16,0 +13,0 @@ * @private |
@@ -9,5 +9,5 @@ /** | ||
function isObjectLike(value) { | ||
return (value && typeof value == 'object') || false; | ||
return !!value && typeof value == 'object'; | ||
} | ||
module.exports = isObjectLike; |
@@ -8,7 +8,6 @@ var arrayCopy = require('./arrayCopy'), | ||
var BIND_FLAG = 1, | ||
BIND_KEY_FLAG = 2, | ||
CURRY_BOUND_FLAG = 4, | ||
CURRY_RIGHT_FLAG = 16, | ||
REARG_FLAG = 128, | ||
ARY_FLAG = 256; | ||
CURRY_FLAG = 8, | ||
ARY_FLAG = 128, | ||
REARG_FLAG = 256; | ||
@@ -39,19 +38,10 @@ /** Used as the internal argument placeholder. */ | ||
srcBitmask = source[1], | ||
newBitmask = bitmask | srcBitmask; | ||
newBitmask = bitmask | srcBitmask, | ||
isCommon = newBitmask < ARY_FLAG; | ||
var arityFlags = ARY_FLAG | REARG_FLAG, | ||
bindFlags = BIND_FLAG | BIND_KEY_FLAG, | ||
comboFlags = arityFlags | bindFlags | CURRY_BOUND_FLAG | CURRY_RIGHT_FLAG; | ||
var isCombo = | ||
(srcBitmask == ARY_FLAG && bitmask == CURRY_FLAG) || | ||
(srcBitmask == ARY_FLAG && bitmask == REARG_FLAG && data[7].length <= source[8]) || | ||
(srcBitmask == (ARY_FLAG | REARG_FLAG) && bitmask == CURRY_FLAG); | ||
var isAry = bitmask & ARY_FLAG && !(srcBitmask & ARY_FLAG), | ||
isRearg = bitmask & REARG_FLAG && !(srcBitmask & REARG_FLAG), | ||
argPos = (isRearg ? data : source)[7], | ||
ary = (isAry ? data : source)[8]; | ||
var isCommon = !(bitmask >= REARG_FLAG && srcBitmask > bindFlags) && | ||
!(bitmask > bindFlags && srcBitmask >= REARG_FLAG); | ||
var isCombo = (newBitmask >= arityFlags && newBitmask <= comboFlags) && | ||
(bitmask < REARG_FLAG || ((isRearg || isAry) && argPos.length <= ary)); | ||
// Exit early if metadata can't be merged. | ||
@@ -58,0 +48,0 @@ if (!(isCommon || isCombo)) { |
@@ -14,5 +14,4 @@ var baseForIn = require('./baseForIn'), | ||
/** | ||
* Used to resolve the `toStringTag` of values. | ||
* See the [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) | ||
* for more details. | ||
* Used to resolve the [`toStringTag`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) | ||
* of values. | ||
*/ | ||
@@ -19,0 +18,0 @@ var objToString = objectProto.toString; |
@@ -12,8 +12,8 @@ var baseClone = require('../internal/baseClone'), | ||
* | ||
* **Note:** This method is loosely based on the structured clone algorithm. | ||
* **Note:** This method is loosely based on the | ||
* [structured clone algorithm](http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm). | ||
* The enumerable properties of `arguments` objects and objects created by | ||
* constructors other than `Object` are cloned to plain `Object` objects. An | ||
* empty object is returned for uncloneable values such as functions, DOM nodes, | ||
* Maps, Sets, and WeakMaps. See the [HTML5 specification](http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm) | ||
* for more details. | ||
* Maps, Sets, and WeakMaps. | ||
* | ||
@@ -20,0 +20,0 @@ * @static |
@@ -10,8 +10,8 @@ var baseClone = require('../internal/baseClone'), | ||
* | ||
* **Note:** This method is loosely based on the structured clone algorithm. | ||
* **Note:** This method is loosely based on the | ||
* [structured clone algorithm](http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm). | ||
* The enumerable properties of `arguments` objects and objects created by | ||
* constructors other than `Object` are cloned to plain `Object` objects. An | ||
* empty object is returned for uncloneable values such as functions, DOM nodes, | ||
* Maps, Sets, and WeakMaps. See the [HTML5 specification](http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm) | ||
* for more details. | ||
* Maps, Sets, and WeakMaps. | ||
* | ||
@@ -18,0 +18,0 @@ * @static |
@@ -11,5 +11,4 @@ var isLength = require('../internal/isLength'), | ||
/** | ||
* Used to resolve the `toStringTag` of values. | ||
* See the [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) | ||
* for more details. | ||
* Used to resolve the [`toStringTag`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) | ||
* of values. | ||
*/ | ||
@@ -36,5 +35,5 @@ var objToString = objectProto.toString; | ||
var length = isObjectLike(value) ? value.length : undefined; | ||
return (isLength(length) && objToString.call(value) == argsTag) || false; | ||
return isLength(length) && objToString.call(value) == argsTag; | ||
} | ||
module.exports = isArguments; |
@@ -12,5 +12,4 @@ var isLength = require('../internal/isLength'), | ||
/** | ||
* Used to resolve the `toStringTag` of values. | ||
* See the [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) | ||
* for more details. | ||
* Used to resolve the [`toStringTag`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) | ||
* of values. | ||
*/ | ||
@@ -39,5 +38,5 @@ var objToString = objectProto.toString; | ||
var isArray = nativeIsArray || function(value) { | ||
return (isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag) || false; | ||
return isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag; | ||
}; | ||
module.exports = isArray; |
@@ -10,5 +10,4 @@ var isObjectLike = require('../internal/isObjectLike'); | ||
/** | ||
* Used to resolve the `toStringTag` of values. | ||
* See the [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) | ||
* for more details. | ||
* Used to resolve the [`toStringTag`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) | ||
* of values. | ||
*/ | ||
@@ -34,5 +33,5 @@ var objToString = objectProto.toString; | ||
function isBoolean(value) { | ||
return (value === true || value === false || isObjectLike(value) && objToString.call(value) == boolTag) || false; | ||
return value === true || value === false || (isObjectLike(value) && objToString.call(value) == boolTag); | ||
} | ||
module.exports = isBoolean; |
@@ -10,5 +10,4 @@ var isObjectLike = require('../internal/isObjectLike'); | ||
/** | ||
* Used to resolve the `toStringTag` of values. | ||
* See the [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) | ||
* for more details. | ||
* Used to resolve the [`toStringTag`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) | ||
* of values. | ||
*/ | ||
@@ -34,5 +33,5 @@ var objToString = objectProto.toString; | ||
function isDate(value) { | ||
return (isObjectLike(value) && objToString.call(value) == dateTag) || false; | ||
return isObjectLike(value) && objToString.call(value) == dateTag; | ||
} | ||
module.exports = isDate; |
@@ -9,5 +9,4 @@ var isObjectLike = require('../internal/isObjectLike'), | ||
/** | ||
* Used to resolve the `toStringTag` of values. | ||
* See the [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) | ||
* for more details. | ||
* Used to resolve the [`toStringTag`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) | ||
* of values. | ||
*/ | ||
@@ -33,4 +32,4 @@ var objToString = objectProto.toString; | ||
function isElement(value) { | ||
return (value && value.nodeType === 1 && isObjectLike(value) && | ||
(objToString.call(value).indexOf('Element') > -1)) || false; | ||
return !!value && value.nodeType === 1 && isObjectLike(value) && | ||
(objToString.call(value).indexOf('Element') > -1); | ||
} | ||
@@ -40,3 +39,3 @@ // Fallback for environments without DOM support. | ||
isElement = function(value) { | ||
return (value && value.nodeType === 1 && isObjectLike(value) && !isPlainObject(value)) || false; | ||
return !!value && value.nodeType === 1 && isObjectLike(value) && !isPlainObject(value); | ||
}; | ||
@@ -43,0 +42,0 @@ } |
@@ -10,3 +10,3 @@ var baseIsEqual = require('../internal/baseIsEqual'), | ||
* instead. The `customizer` is bound to `thisArg` and invoked with three | ||
* arguments; (value, other [, index|key]). | ||
* arguments: (value, other [, index|key]). | ||
* | ||
@@ -13,0 +13,0 @@ * **Note:** This method supports comparing arrays, booleans, `Date` objects, |
@@ -10,5 +10,4 @@ var isObjectLike = require('../internal/isObjectLike'); | ||
/** | ||
* Used to resolve the `toStringTag` of values. | ||
* See the [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) | ||
* for more details. | ||
* Used to resolve the [`toStringTag`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) | ||
* of values. | ||
*/ | ||
@@ -35,5 +34,5 @@ var objToString = objectProto.toString; | ||
function isError(value) { | ||
return (isObjectLike(value) && typeof value.message == 'string' && objToString.call(value) == errorTag) || false; | ||
return isObjectLike(value) && typeof value.message == 'string' && objToString.call(value) == errorTag; | ||
} | ||
module.exports = isError; |
@@ -10,5 +10,3 @@ var isNative = require('./isNative'); | ||
* | ||
* **Note:** This method is based on ES `Number.isFinite`. See the | ||
* [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.isfinite) | ||
* for more details. | ||
* **Note:** This method is based on [`Number.isFinite`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.isfinite). | ||
* | ||
@@ -15,0 +13,0 @@ * @static |
@@ -11,5 +11,4 @@ var baseIsFunction = require('../internal/baseIsFunction'), | ||
/** | ||
* Used to resolve the `toStringTag` of values. | ||
* See the [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) | ||
* for more details. | ||
* Used to resolve the [`toStringTag`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) | ||
* of values. | ||
*/ | ||
@@ -16,0 +15,0 @@ var objToString = objectProto.toString; |
var baseIsMatch = require('../internal/baseIsMatch'), | ||
bindCallback = require('../internal/bindCallback'), | ||
isStrictComparable = require('../internal/isStrictComparable'), | ||
keys = require('../object/keys'); | ||
keys = require('../object/keys'), | ||
toObject = require('../internal/toObject'); | ||
/** Used for native method references. */ | ||
var objectProto = Object.prototype; | ||
/** Used to check objects for own properties. */ | ||
var hasOwnProperty = objectProto.hasOwnProperty; | ||
/** | ||
@@ -17,3 +12,3 @@ * Performs a deep comparison between `object` and `source` to determine if | ||
* comparisons are handled by the method instead. The `customizer` is bound | ||
* to `thisArg` and invoked with three arguments; (value, other, index|key). | ||
* to `thisArg` and invoked with three arguments: (value, other, index|key). | ||
* | ||
@@ -56,2 +51,8 @@ * **Note:** This method supports comparing properties of arrays, booleans, | ||
if (!length) { | ||
return true; | ||
} | ||
if (object == null) { | ||
return false; | ||
} | ||
customizer = typeof customizer == 'function' && bindCallback(customizer, thisArg, 3); | ||
@@ -63,3 +64,3 @@ if (!customizer && length == 1) { | ||
if (isStrictComparable(value)) { | ||
return object != null && value === object[key] && hasOwnProperty.call(object, key); | ||
return value === object[key] && (typeof value != 'undefined' || (key in toObject(object))); | ||
} | ||
@@ -74,5 +75,5 @@ } | ||
} | ||
return baseIsMatch(object, props, values, strictCompareFlags, customizer); | ||
return baseIsMatch(toObject(object), props, values, strictCompareFlags, customizer); | ||
} | ||
module.exports = isMatch; |
@@ -6,5 +6,4 @@ var isNumber = require('./isNumber'); | ||
* | ||
* **Note:** This method is not the same as native `isNaN` which returns `true` | ||
* for `undefined` and other non-numeric values. See the [ES5 spec](https://es5.github.io/#x15.1.2.4) | ||
* for more details. | ||
* **Note:** This method is not the same as [`isNaN`](https://es5.github.io/#x15.1.2.4) | ||
* which returns `true` for `undefined` and other non-numeric values. | ||
* | ||
@@ -11,0 +10,0 @@ * @static |
@@ -17,5 +17,4 @@ var escapeRegExp = require('../string/escapeRegExp'), | ||
/** | ||
* Used to resolve the `toStringTag` of values. | ||
* See the [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) | ||
* for more details. | ||
* Used to resolve the [`toStringTag`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) | ||
* of values. | ||
*/ | ||
@@ -53,5 +52,5 @@ var objToString = objectProto.toString; | ||
} | ||
return (isObjectLike(value) && reHostCtor.test(value)) || false; | ||
return isObjectLike(value) && reHostCtor.test(value); | ||
} | ||
module.exports = isNative; |
@@ -10,5 +10,4 @@ var isObjectLike = require('../internal/isObjectLike'); | ||
/** | ||
* Used to resolve the `toStringTag` of values. | ||
* See the [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) | ||
* for more details. | ||
* Used to resolve the [`toStringTag`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) | ||
* of values. | ||
*/ | ||
@@ -40,5 +39,5 @@ var objToString = objectProto.toString; | ||
function isNumber(value) { | ||
return typeof value == 'number' || (isObjectLike(value) && objToString.call(value) == numberTag) || false; | ||
return typeof value == 'number' || (isObjectLike(value) && objToString.call(value) == numberTag); | ||
} | ||
module.exports = isNumber; |
/** | ||
* Checks if `value` is the language type of `Object`. | ||
* Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. | ||
* (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) | ||
* | ||
* **Note:** See the [ES5 spec](https://es5.github.io/#x8) for more details. | ||
* | ||
* @static | ||
@@ -27,5 +25,5 @@ * @memberOf _ | ||
var type = typeof value; | ||
return type == 'function' || (value && type == 'object') || false; | ||
return type == 'function' || (!!value && type == 'object'); | ||
} | ||
module.exports = isObject; |
@@ -11,5 +11,4 @@ var isNative = require('./isNative'), | ||
/** | ||
* Used to resolve the `toStringTag` of values. | ||
* See the [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) | ||
* for more details. | ||
* Used to resolve the [`toStringTag`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) | ||
* of values. | ||
*/ | ||
@@ -16,0 +15,0 @@ var objToString = objectProto.toString; |
@@ -10,5 +10,4 @@ var isObjectLike = require('../internal/isObjectLike'); | ||
/** | ||
* Used to resolve the `toStringTag` of values. | ||
* See the [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) | ||
* for more details. | ||
* Used to resolve the [`toStringTag`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) | ||
* of values. | ||
*/ | ||
@@ -15,0 +14,0 @@ var objToString = objectProto.toString; |
@@ -10,5 +10,4 @@ var isObjectLike = require('../internal/isObjectLike'); | ||
/** | ||
* Used to resolve the `toStringTag` of values. | ||
* See the [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) | ||
* for more details. | ||
* Used to resolve the [`toStringTag`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) | ||
* of values. | ||
*/ | ||
@@ -34,5 +33,5 @@ var objToString = objectProto.toString; | ||
function isString(value) { | ||
return typeof value == 'string' || (isObjectLike(value) && objToString.call(value) == stringTag) || false; | ||
return typeof value == 'string' || (isObjectLike(value) && objToString.call(value) == stringTag); | ||
} | ||
module.exports = isString; |
@@ -49,5 +49,4 @@ var isLength = require('../internal/isLength'), | ||
/** | ||
* Used to resolve the `toStringTag` of values. | ||
* See the [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) | ||
* for more details. | ||
* Used to resolve the [`toStringTag`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) | ||
* of values. | ||
*/ | ||
@@ -73,5 +72,5 @@ var objToString = objectProto.toString; | ||
function isTypedArray(value) { | ||
return (isObjectLike(value) && isLength(value.length) && typedArrayTags[objToString.call(value)]) || false; | ||
return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[objToString.call(value)]; | ||
} | ||
module.exports = isTypedArray; |
@@ -9,5 +9,5 @@ var arrayMax = require('../internal/arrayMax'), | ||
* is ranked. The `iteratee` is bound to `thisArg` and invoked with three | ||
* arguments; (value, index, collection). | ||
* arguments: (value, index, collection). | ||
* | ||
* If a property name is provided for `predicate` the created `_.property` | ||
* If a property name is provided for `iteratee` the created `_.property` | ||
* style callback returns the property value of the given element. | ||
@@ -19,3 +19,3 @@ * | ||
* | ||
* If an object is provided for `predicate` the created `_.matches` style | ||
* If an object is provided for `iteratee` the created `_.matches` style | ||
* callback returns `true` for elements that have the properties of the given | ||
@@ -47,7 +47,7 @@ * object, else `false`. | ||
* }); | ||
* // => { 'user': 'fred', 'age': 40 }; | ||
* // => { 'user': 'fred', 'age': 40 } | ||
* | ||
* // using the `_.property` callback shorthand | ||
* _.max(users, 'age'); | ||
* // => { 'user': 'fred', 'age': 40 }; | ||
* // => { 'user': 'fred', 'age': 40 } | ||
*/ | ||
@@ -54,0 +54,0 @@ var max = createExtremum(arrayMax); |
@@ -9,5 +9,5 @@ var arrayMin = require('../internal/arrayMin'), | ||
* is ranked. The `iteratee` is bound to `thisArg` and invoked with three | ||
* arguments; (value, index, collection). | ||
* arguments: (value, index, collection). | ||
* | ||
* If a property name is provided for `predicate` the created `_.property` | ||
* If a property name is provided for `iteratee` the created `_.property` | ||
* style callback returns the property value of the given element. | ||
@@ -19,3 +19,3 @@ * | ||
* | ||
* If an object is provided for `predicate` the created `_.matches` style | ||
* If an object is provided for `iteratee` the created `_.matches` style | ||
* callback returns `true` for elements that have the properties of the given | ||
@@ -47,7 +47,7 @@ * object, else `false`. | ||
* }); | ||
* // => { 'user': 'barney', 'age': 36 }; | ||
* // => { 'user': 'barney', 'age': 36 } | ||
* | ||
* // using the `_.property` callback shorthand | ||
* _.min(users, 'age'); | ||
* // => { 'user': 'barney', 'age': 36 }; | ||
* // => { 'user': 'barney', 'age': 36 } | ||
*/ | ||
@@ -54,0 +54,0 @@ var min = createExtremum(arrayMin, true); |
@@ -1,2 +0,6 @@ | ||
var isArray = require('../lang/isArray'), | ||
var arraySum = require('../internal/arraySum'), | ||
baseCallback = require('../internal/baseCallback'), | ||
baseSum = require('../internal/baseSum'), | ||
isArray = require('../lang/isArray'), | ||
isIterateeCall = require('../internal/isIterateeCall'), | ||
toIterable = require('../internal/toIterable'); | ||
@@ -11,24 +15,39 @@ | ||
* @param {Array|Object|string} collection The collection to iterate over. | ||
* @param {Function|Object|string} [iteratee] The function invoked per iteration. | ||
* @param {*} [thisArg] The `this` binding of `iteratee`. | ||
* @returns {number} Returns the sum. | ||
* @example | ||
* | ||
* _.sum([4, 6, 2]); | ||
* // => 12 | ||
* _.sum([4, 6]); | ||
* // => 10 | ||
* | ||
* _.sum({ 'a': 4, 'b': 6, 'c': 2 }); | ||
* // => 12 | ||
* _.sum({ 'a': 4, 'b': 6 }); | ||
* // => 10 | ||
* | ||
* var objects = [ | ||
* { 'n': 4 }, | ||
* { 'n': 6 } | ||
* ]; | ||
* | ||
* _.sum(objects, function(object) { | ||
* return object.n; | ||
* }); | ||
* // => 10 | ||
* | ||
* // using the `_.property` callback shorthand | ||
* _.sum(objects, 'n'); | ||
* // => 10 | ||
*/ | ||
function sum(collection) { | ||
if (!isArray(collection)) { | ||
collection = toIterable(collection); | ||
function sum(collection, iteratee, thisArg) { | ||
if (thisArg && isIterateeCall(collection, iteratee, thisArg)) { | ||
iteratee = null; | ||
} | ||
var length = collection.length, | ||
result = 0; | ||
var noIteratee = iteratee == null; | ||
while (length--) { | ||
result += +collection[length] || 0; | ||
} | ||
return result; | ||
iteratee = noIteratee ? iteratee : baseCallback(iteratee, thisArg, 3); | ||
return noIteratee | ||
? arraySum(isArray(collection) ? collection : toIterable(collection)) | ||
: baseSum(collection, iteratee); | ||
} | ||
module.exports = sum; |
@@ -8,3 +8,3 @@ var baseAssign = require('../internal/baseAssign'), | ||
* If `customizer` is provided it is invoked to produce the assigned values. | ||
* The `customizer` is bound to `thisArg` and invoked with five arguments; | ||
* The `customizer` is bound to `thisArg` and invoked with five arguments: | ||
* (objectValue, sourceValue, key, object, source). | ||
@@ -11,0 +11,0 @@ * |
@@ -1,4 +0,4 @@ | ||
var arrayCopy = require('../internal/arrayCopy'), | ||
assign = require('./assign'), | ||
assignDefaults = require('../internal/assignDefaults'); | ||
var assign = require('./assign'), | ||
assignDefaults = require('../internal/assignDefaults'), | ||
restParam = require('../function/restParam'); | ||
@@ -21,11 +21,11 @@ /** | ||
*/ | ||
function defaults(object) { | ||
var defaults = restParam(function(args) { | ||
var object = args[0]; | ||
if (object == null) { | ||
return object; | ||
} | ||
var args = arrayCopy(arguments); | ||
args.push(assignDefaults); | ||
return assign.apply(undefined, args); | ||
} | ||
}); | ||
module.exports = defaults; |
@@ -1,8 +0,7 @@ | ||
var baseCallback = require('../internal/baseCallback'), | ||
baseFind = require('../internal/baseFind'), | ||
baseForOwn = require('../internal/baseForOwn'); | ||
var baseForOwn = require('../internal/baseForOwn'), | ||
createFindKey = require('../internal/createFindKey'); | ||
/** | ||
* This method is like `_.findIndex` except that it returns the key of the | ||
* first element `predicate` returns truthy for, instead of the element itself. | ||
* This method is like `_.find` except that it returns the key of the first | ||
* element `predicate` returns truthy for instead of the element itself. | ||
* | ||
@@ -53,7 +52,4 @@ * If a property name is provided for `predicate` the created `_.property` | ||
*/ | ||
function findKey(object, predicate, thisArg) { | ||
predicate = baseCallback(predicate, thisArg, 3); | ||
return baseFind(object, predicate, baseForOwn, true); | ||
} | ||
var findKey = createFindKey(baseForOwn); | ||
module.exports = findKey; |
@@ -1,4 +0,3 @@ | ||
var baseCallback = require('../internal/baseCallback'), | ||
baseFind = require('../internal/baseFind'), | ||
baseForOwnRight = require('../internal/baseForOwnRight'); | ||
var baseForOwnRight = require('../internal/baseForOwnRight'), | ||
createFindKey = require('../internal/createFindKey'); | ||
@@ -53,7 +52,4 @@ /** | ||
*/ | ||
function findLastKey(object, predicate, thisArg) { | ||
predicate = baseCallback(predicate, thisArg, 3); | ||
return baseFind(object, predicate, baseForOwnRight, true); | ||
} | ||
var findLastKey = createFindKey(baseForOwnRight); | ||
module.exports = findLastKey; |
var baseFor = require('../internal/baseFor'), | ||
bindCallback = require('../internal/bindCallback'), | ||
keysIn = require('./keysIn'); | ||
createForIn = require('../internal/createForIn'); | ||
@@ -8,3 +7,3 @@ /** | ||
* `iteratee` for each property. The `iteratee` is bound to `thisArg` and invoked | ||
* with three arguments; (value, key, object). Iterator functions may exit | ||
* with three arguments: (value, key, object). Iterator functions may exit | ||
* iteration early by explicitly returning `false`. | ||
@@ -33,9 +32,4 @@ * | ||
*/ | ||
function forIn(object, iteratee, thisArg) { | ||
if (typeof iteratee != 'function' || typeof thisArg != 'undefined') { | ||
iteratee = bindCallback(iteratee, thisArg, 3); | ||
} | ||
return baseFor(object, iteratee, keysIn); | ||
} | ||
var forIn = createForIn(baseFor); | ||
module.exports = forIn; |
var baseForRight = require('../internal/baseForRight'), | ||
bindCallback = require('../internal/bindCallback'), | ||
keysIn = require('./keysIn'); | ||
createForIn = require('../internal/createForIn'); | ||
@@ -30,7 +29,4 @@ /** | ||
*/ | ||
function forInRight(object, iteratee, thisArg) { | ||
iteratee = bindCallback(iteratee, thisArg, 3); | ||
return baseForRight(object, iteratee, keysIn); | ||
} | ||
var forInRight = createForIn(baseForRight); | ||
module.exports = forInRight; |
var baseForOwn = require('../internal/baseForOwn'), | ||
bindCallback = require('../internal/bindCallback'); | ||
createForOwn = require('../internal/createForOwn'); | ||
@@ -7,3 +7,3 @@ /** | ||
* for each property. The `iteratee` is bound to `thisArg` and invoked with | ||
* three arguments; (value, key, object). Iterator functions may exit iteration | ||
* three arguments: (value, key, object). Iterator functions may exit iteration | ||
* early by explicitly returning `false`. | ||
@@ -32,9 +32,4 @@ * | ||
*/ | ||
function forOwn(object, iteratee, thisArg) { | ||
if (typeof iteratee != 'function' || typeof thisArg != 'undefined') { | ||
iteratee = bindCallback(iteratee, thisArg, 3); | ||
} | ||
return baseForOwn(object, iteratee); | ||
} | ||
var forOwn = createForOwn(baseForOwn); | ||
module.exports = forOwn; |
@@ -1,4 +0,3 @@ | ||
var baseForRight = require('../internal/baseForRight'), | ||
bindCallback = require('../internal/bindCallback'), | ||
keys = require('./keys'); | ||
var baseForOwnRight = require('../internal/baseForOwnRight'), | ||
createForOwn = require('../internal/createForOwn'); | ||
@@ -30,7 +29,4 @@ /** | ||
*/ | ||
function forOwnRight(object, iteratee, thisArg) { | ||
iteratee = bindCallback(iteratee, thisArg, 3); | ||
return baseForRight(object, iteratee, keys); | ||
} | ||
var forOwnRight = createForOwn(baseForOwnRight); | ||
module.exports = forOwnRight; |
@@ -7,3 +7,3 @@ var baseCallback = require('../internal/baseCallback'), | ||
* running each own enumerable property of `object` through `iteratee`. The | ||
* iteratee function is bound to `thisArg` and invoked with three arguments; | ||
* iteratee function is bound to `thisArg` and invoked with three arguments: | ||
* (value, key, object). | ||
@@ -10,0 +10,0 @@ * |
@@ -11,3 +11,3 @@ var baseMerge = require('../internal/baseMerge'), | ||
* by the method instead. The `customizer` is bound to `thisArg` and invoked | ||
* with five arguments; (objectValue, sourceValue, key, object, source). | ||
* with five arguments: (objectValue, sourceValue, key, object, source). | ||
* | ||
@@ -14,0 +14,0 @@ * @static |
@@ -7,3 +7,4 @@ var arrayMap = require('../internal/arrayMap'), | ||
pickByArray = require('../internal/pickByArray'), | ||
pickByCallback = require('../internal/pickByCallback'); | ||
pickByCallback = require('../internal/pickByCallback'), | ||
restParam = require('../function/restParam'); | ||
@@ -16,3 +17,3 @@ /** | ||
* of `object` omitting the properties `predicate` returns truthy for. The | ||
* predicate is bound to `thisArg` and invoked with three arguments; | ||
* predicate is bound to `thisArg` and invoked with three arguments: | ||
* (value, key, object). | ||
@@ -39,16 +40,16 @@ * | ||
*/ | ||
function omit(object, predicate, thisArg) { | ||
var omit = restParam(function(object, props) { | ||
if (object == null) { | ||
return {}; | ||
} | ||
if (typeof predicate != 'function') { | ||
var props = arrayMap(baseFlatten(arguments, false, false, 1), String); | ||
if (typeof props[0] != 'function') { | ||
var props = arrayMap(baseFlatten(props), String); | ||
return pickByArray(object, baseDifference(keysIn(object), props)); | ||
} | ||
predicate = bindCallback(predicate, thisArg, 3); | ||
var predicate = bindCallback(props[0], props[1], 3); | ||
return pickByCallback(object, function(value, key, object) { | ||
return !predicate(value, key, object); | ||
}); | ||
} | ||
}); | ||
module.exports = omit; |
var baseFlatten = require('../internal/baseFlatten'), | ||
bindCallback = require('../internal/bindCallback'), | ||
pickByArray = require('../internal/pickByArray'), | ||
pickByCallback = require('../internal/pickByCallback'); | ||
pickByCallback = require('../internal/pickByCallback'), | ||
restParam = require('../function/restParam'); | ||
@@ -11,3 +12,3 @@ /** | ||
* picking the properties `predicate` returns truthy for. The predicate is | ||
* bound to `thisArg` and invoked with three arguments; (value, key, object). | ||
* bound to `thisArg` and invoked with three arguments: (value, key, object). | ||
* | ||
@@ -33,11 +34,11 @@ * @static | ||
*/ | ||
function pick(object, predicate, thisArg) { | ||
var pick = restParam(function(object, props) { | ||
if (object == null) { | ||
return {}; | ||
} | ||
return typeof predicate == 'function' | ||
? pickByCallback(object, bindCallback(predicate, thisArg, 3)) | ||
: pickByArray(object, baseFlatten(arguments, false, false, 1)); | ||
} | ||
return typeof props[0] == 'function' | ||
? pickByCallback(object, bindCallback(props[0], props[1], 3)) | ||
: pickByArray(object, baseFlatten(props)); | ||
}); | ||
module.exports = pick; |
@@ -15,3 +15,3 @@ var arrayEach = require('../internal/arrayEach'), | ||
* the `accumulator` object. The `iteratee` is bound to `thisArg` and invoked | ||
* with four arguments; (accumulator, value, key, object). Iterator functions | ||
* with four arguments: (accumulator, value, key, object). Iterator functions | ||
* may exit iteration early by explicitly returning `false`. | ||
@@ -18,0 +18,0 @@ * |
{ | ||
"name": "lodash", | ||
"version": "3.5.0", | ||
"version": "3.6.0", | ||
"description": "The modern build of lodash modular utilities.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://lodash.com/", |
@@ -1,2 +0,2 @@ | ||
# lodash v3.5.0 | ||
# lodash v3.6.0 | ||
@@ -31,3 +31,3 @@ The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash](https://lodash.com/) exported as [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) modules. | ||
See the [package source](https://github.com/lodash/lodash/tree/3.5.0-npm) for more details. | ||
See the [package source](https://github.com/lodash/lodash/tree/3.6.0-npm) for more details. | ||
@@ -43,4 +43,4 @@ **Note:**<br> | ||
* npm packages for [modern](https://www.npmjs.com/package/lodash), [compatibility](https://www.npmjs.com/package/lodash-compat), & [per method](https://www.npmjs.com/browse/keyword/lodash-modularized) builds | ||
* AMD modules for [modern](https://github.com/lodash/lodash/tree/3.5.0-amd) & [compatibility](https://github.com/lodash/lodash-compat/tree/3.5.0-amd) builds | ||
* ES modules for the [modern](https://github.com/lodash/lodash/tree/3.5.0-es) build | ||
* AMD modules for [modern](https://github.com/lodash/lodash/tree/3.6.0-amd) & [compatibility](https://github.com/lodash/lodash-compat/tree/3.6.0-amd) builds | ||
* ES modules for the [modern](https://github.com/lodash/lodash/tree/3.6.0-es) build | ||
@@ -56,3 +56,3 @@ ## Further Reading | ||
## Features *not* in Underscore | ||
## Features | ||
@@ -91,6 +91,6 @@ * ~100% [code coverage](https://coveralls.io/r/lodash) | ||
* [_.random](https://lodash.com/docs#random) supports returning floating-point numbers | ||
* [_.restParam](https://lodash.com/docs#restParam) & [_.spread](https://lodash.com/docs#spread) for applying rest parameters & spreading arguments to functions | ||
* [_.runInContext](https://lodash.com/docs#runInContext) for collisionless mixins & easier mocking | ||
* [_.slice](https://lodash.com/docs#slice) for creating subsets of array-like values | ||
* [_.sortByAll](https://lodash.com/docs#sortByAll) & [_.sortByOrder](https://lodash.com/docs#sortByOrder) for sorting by multiple properties & orders | ||
* [_.spread](https://lodash.com/docs#spread) for creating a function to spread an array of arguments to another | ||
* [_.sum](https://lodash.com/docs#sum) to get the sum of values | ||
@@ -119,3 +119,3 @@ * [_.support](https://lodash.com/docs#support) for flagging environment features | ||
Tested in Chrome 40-41, Firefox 35-36, IE 6-11, Opera 26-27, Safari 5-8, io.js 1.5.0, Node.js 0.8.28, 0.10.36, & 0.12.0, PhantomJS 1.9.8, RingoJS 0.11, & Rhino 1.7RC5. | ||
Tested in Chrome 40-41, Firefox 35-36, IE 6-11, Opera 27-28, Safari 5-8, io.js 1.6.2, Node.js 0.8.28, 0.10.36, & 0.12.0, PhantomJS 1.9.8, RingoJS 0.11, & Rhino 1.7RC5. | ||
Automated [browser](https://saucelabs.com/u/lodash) & [CI](https://travis-ci.org/lodash/lodash/) test runs are available. Special thanks to [Sauce Labs](https://saucelabs.com/) for providing automated browser testing. |
var createCompounder = require('../internal/createCompounder'); | ||
/** | ||
* Converts `string` to camel case. | ||
* See [Wikipedia](https://en.wikipedia.org/wiki/CamelCase) for more details. | ||
* Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase). | ||
* | ||
@@ -7,0 +6,0 @@ * @static |
var baseToString = require('../internal/baseToString'), | ||
deburrLetter = require('../internal/deburrLetter'); | ||
/** | ||
* Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks). | ||
*/ | ||
var reComboMarks = /[\u0300-\u036f\ufe20-\ufe23]/g; | ||
/** Used to match latin-1 supplementary letters (excluding mathematical operators). */ | ||
@@ -8,5 +13,4 @@ var reLatin1 = /[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g; | ||
/** | ||
* Deburrs `string` by converting latin-1 supplementary letters to basic latin letters. | ||
* See [Wikipedia](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table) | ||
* for more details. | ||
* Deburrs `string` by converting [latin-1 supplementary letters](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table) | ||
* to basic latin letters and removing [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks). | ||
* | ||
@@ -25,5 +29,5 @@ * @static | ||
string = baseToString(string); | ||
return string && string.replace(reLatin1, deburrLetter); | ||
return string && string.replace(reLatin1, deburrLetter).replace(reComboMarks, ''); | ||
} | ||
module.exports = deburr; |
@@ -26,5 +26,4 @@ var baseToString = require('../internal/baseToString'), | ||
* | ||
* When working with HTML you should always quote attribute values to reduce | ||
* XSS vectors. See [Ryan Grove's article](http://wonko.com/post/html-escaping) | ||
* for more details. | ||
* When working with HTML you should always [quote attribute values](http://wonko.com/post/html-escaping) | ||
* to reduce XSS vectors. | ||
* | ||
@@ -31,0 +30,0 @@ * @static |
var baseToString = require('../internal/baseToString'); | ||
/** | ||
* Used to match `RegExp` special characters. | ||
* See this [article on `RegExp` characters](http://www.regular-expressions.info/characters.html#special) | ||
* for more details. | ||
* Used to match `RegExp` [special characters](http://www.regular-expressions.info/characters.html#special). | ||
* In addition to special characters the forward slash is escaped to allow for | ||
* easier `eval` use and `Function` compilation. | ||
*/ | ||
@@ -12,4 +12,4 @@ var reRegExpChars = /[.*+?^${}()|[\]\/\\]/g, | ||
/** | ||
* Escapes the `RegExp` special characters "\", "^", "$", ".", "|", "?", "*", | ||
* "+", "(", ")", "[", "]", "{" and "}" in `string`. | ||
* Escapes the `RegExp` special characters "\", "/", "^", "$", ".", "|", "?", | ||
* "*", "+", "(", ")", "[", "]", "{" and "}" in `string`. | ||
* | ||
@@ -24,3 +24,3 @@ * @static | ||
* _.escapeRegExp('[lodash](https://lodash.com/)'); | ||
* // => '\[lodash\]\(https://lodash\.com/\)' | ||
* // => '\[lodash\]\(https:\/\/lodash\.com\/\)' | ||
*/ | ||
@@ -27,0 +27,0 @@ function escapeRegExp(string) { |
var createCompounder = require('../internal/createCompounder'); | ||
/** | ||
* Converts `string` to kebab case. | ||
* See [Wikipedia](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles) for | ||
* more details. | ||
* Converts `string` to [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles). | ||
* | ||
@@ -8,0 +6,0 @@ * @static |
var baseToString = require('../internal/baseToString'), | ||
createPad = require('../internal/createPad'); | ||
createPadding = require('../internal/createPadding'); | ||
@@ -12,5 +12,4 @@ /** Native method references. */ | ||
/** | ||
* Pads `string` on the left and right sides if it is shorter then the given | ||
* padding length. The `chars` string may be truncated if the number of padding | ||
* characters can't be evenly divided by the padding length. | ||
* Pads `string` on the left and right sides if it is shorter than `length`. | ||
* Padding characters are truncated if they can't be evenly divided by `length`. | ||
* | ||
@@ -47,3 +46,3 @@ * @static | ||
chars = createPad('', rightLength, chars); | ||
chars = createPadding('', rightLength, chars); | ||
return chars.slice(0, leftLength) + string + chars; | ||
@@ -50,0 +49,0 @@ } |
@@ -1,8 +0,6 @@ | ||
var baseToString = require('../internal/baseToString'), | ||
createPad = require('../internal/createPad'); | ||
var createPadDir = require('../internal/createPadDir'); | ||
/** | ||
* Pads `string` on the left side if it is shorter then the given padding | ||
* length. The `chars` string may be truncated if the number of padding | ||
* characters exceeds the padding length. | ||
* Pads `string` on the left side if it is shorter than `length`. Padding | ||
* characters are truncated if they exceed `length`. | ||
* | ||
@@ -27,7 +25,4 @@ * @static | ||
*/ | ||
function padLeft(string, length, chars) { | ||
string = baseToString(string); | ||
return string && (createPad(string, length, chars) + string); | ||
} | ||
var padLeft = createPadDir(); | ||
module.exports = padLeft; |
@@ -1,8 +0,6 @@ | ||
var baseToString = require('../internal/baseToString'), | ||
createPad = require('../internal/createPad'); | ||
var createPadDir = require('../internal/createPadDir'); | ||
/** | ||
* Pads `string` on the right side if it is shorter then the given padding | ||
* length. The `chars` string may be truncated if the number of padding | ||
* characters exceeds the padding length. | ||
* Pads `string` on the right side if it is shorter than `length`. Padding | ||
* characters are truncated if they exceed `length`. | ||
* | ||
@@ -27,7 +25,4 @@ * @static | ||
*/ | ||
function padRight(string, length, chars) { | ||
string = baseToString(string); | ||
return string && (string + createPad(string, length, chars)); | ||
} | ||
var padRight = createPadDir(true); | ||
module.exports = padRight; |
@@ -27,4 +27,4 @@ var isIterateeCall = require('../internal/isIterateeCall'), | ||
* | ||
* **Note:** This method aligns with the ES5 implementation of `parseInt`. | ||
* See the [ES5 spec](https://es5.github.io/#E) for more details. | ||
* **Note:** This method aligns with the [ES5 implementation](https://es5.github.io/#E) | ||
* of `parseInt`. | ||
* | ||
@@ -31,0 +31,0 @@ * @static |
var createCompounder = require('../internal/createCompounder'); | ||
/** | ||
* Converts `string` to snake case. | ||
* See [Wikipedia](https://en.wikipedia.org/wiki/Snake_case) for more details. | ||
* Converts `string` to [snake case](https://en.wikipedia.org/wiki/Snake_case). | ||
* | ||
@@ -7,0 +6,0 @@ * @static |
var createCompounder = require('../internal/createCompounder'); | ||
/** | ||
* Converts `string` to start case. | ||
* See [Wikipedia](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage) | ||
* for more details. | ||
* Converts `string` to [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage). | ||
* | ||
@@ -8,0 +6,0 @@ * @static |
@@ -19,5 +19,3 @@ var assignOwnDefaults = require('../internal/assignOwnDefaults'), | ||
/** | ||
* Used to match ES template delimiters. | ||
* See the [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-template-literal-lexical-components) | ||
* for more details. | ||
* Used to match [ES template delimiters](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-template-literal-lexical-components). | ||
*/ | ||
@@ -39,5 +37,5 @@ var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g; | ||
* | ||
* **Note:** In the development build `_.template` utilizes sourceURLs for easier debugging. | ||
* See the [HTML5 Rocks article on sourcemaps](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl) | ||
* for more details. | ||
* **Note:** In the development build `_.template` utilizes | ||
* [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl) | ||
* for easier debugging. | ||
* | ||
@@ -44,0 +42,0 @@ * For more information on precompiling templates see |
@@ -27,3 +27,3 @@ var baseToString = require('../internal/baseToString'), | ||
* _.map([' foo ', ' bar '], _.trim); | ||
* // => ['foo', 'bar] | ||
* // => ['foo', 'bar'] | ||
*/ | ||
@@ -30,0 +30,0 @@ function trim(string, chars, guard) { |
@@ -46,3 +46,3 @@ var baseToString = require('../internal/baseToString'), | ||
* }); | ||
* //=> 'hi-diddly-ho there...' | ||
* // => 'hi-diddly-ho there...' | ||
* | ||
@@ -49,0 +49,0 @@ * _.trunc('hi-diddly-ho there, neighborino', { |
@@ -1,6 +0,1 @@ | ||
var isNative = require('./lang/isNative'); | ||
/** Used to detect functions containing a `this` reference. */ | ||
var reThis = /\bthis\b/; | ||
/** Used for native method references. */ | ||
@@ -34,3 +29,3 @@ var objectProto = Object.prototype; | ||
*/ | ||
support.funcDecomp = !isNative(global.WinRTError) && reThis.test(function() { return this; }); | ||
support.funcDecomp = /\bthis\b/.test(function() { return this; }); | ||
@@ -37,0 +32,0 @@ /** |
@@ -1,2 +0,3 @@ | ||
var isError = require('../lang/isError'); | ||
var isError = require('../lang/isError'), | ||
restParam = require('../function/restParam'); | ||
@@ -10,3 +11,3 @@ /** | ||
* @category Utility | ||
* @param {*} func The function to attempt. | ||
* @param {Function} func The function to attempt. | ||
* @returns {*} Returns the `func` result or error object. | ||
@@ -24,10 +25,3 @@ * @example | ||
*/ | ||
function attempt() { | ||
var func = arguments[0], | ||
length = arguments.length, | ||
args = Array(length ? (length - 1) : 0); | ||
while (--length > 0) { | ||
args[length - 1] = arguments[length]; | ||
} | ||
var attempt = restParam(function(func, args) { | ||
try { | ||
@@ -38,4 +32,4 @@ return func.apply(undefined, args); | ||
} | ||
} | ||
}); | ||
module.exports = attempt; |
@@ -22,8 +22,7 @@ var baseClone = require('../internal/baseClone'), | ||
* { 'user': 'barney' }, | ||
* { 'user': 'fred' }, | ||
* { 'user': 'pebbles' } | ||
* { 'user': 'fred' } | ||
* ]; | ||
* | ||
* _.find(users, _.matchesProperty('user', 'fred')); | ||
* // => { 'user': 'fred', 'age': 40 } | ||
* // => { 'user': 'fred' } | ||
*/ | ||
@@ -30,0 +29,0 @@ function matchesProperty(key, value) { |
@@ -18,2 +18,5 @@ var arrayCopy = require('../internal/arrayCopy'), | ||
* | ||
* **Note:** Use `_.runInContext` to create a pristine `lodash` function | ||
* for mixins to avoid conflicts caused by modifying the original. | ||
* | ||
* @static | ||
@@ -36,3 +39,3 @@ * @memberOf _ | ||
* | ||
* // use `_.runInContext` to avoid potential conflicts (esp. in Node.js) | ||
* // use `_.runInContext` to avoid conflicts (esp. in Node.js) | ||
* var _ = require('lodash').runInContext(); | ||
@@ -74,8 +77,6 @@ * | ||
if (chain || chainAll) { | ||
var result = object(this.__wrapped__); | ||
(result.__actions__ = arrayCopy(this.__actions__)).push({ | ||
'func': func, | ||
'args': arguments, | ||
'thisArg': object | ||
}); | ||
var result = object(this.__wrapped__), | ||
actions = result.__actions__ = arrayCopy(this.__actions__); | ||
actions.push({ 'func': func, 'args': arguments, 'thisArg': object }); | ||
result.__chain__ = chainAll; | ||
@@ -82,0 +83,0 @@ return result; |
@@ -21,3 +21,3 @@ var baseProperty = require('../internal/baseProperty'); | ||
* _.map(users, getName); | ||
* // => ['fred', barney'] | ||
* // => ['fred', 'barney'] | ||
* | ||
@@ -24,0 +24,0 @@ * _.pluck(_.sortBy(users, getName), 'user'); |
/** | ||
* The inverse of `_.property`; this method creates a function which returns | ||
* The opposite of `_.property`; this method creates a function which returns | ||
* the property value of a given key on `object`. | ||
@@ -4,0 +4,0 @@ * |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
804633
387
23207