Comparing version 3.6.0 to 3.7.0
@@ -30,3 +30,4 @@ import baseIndexOf from '../internal/baseIndexOf'; | ||
indexOf = baseIndexOf, | ||
isCommon = true; | ||
isCommon = true, | ||
result = []; | ||
@@ -41,6 +42,8 @@ while (++argsIndex < argsLength) { | ||
argsLength = args.length; | ||
if (argsLength < 2) { | ||
return result; | ||
} | ||
var array = args[0], | ||
index = -1, | ||
length = array ? array.length : 0, | ||
result = [], | ||
seen = caches[0]; | ||
@@ -47,0 +50,0 @@ |
import baseAt from '../internal/baseAt'; | ||
import baseCompareAscending from '../internal/baseCompareAscending'; | ||
import baseFlatten from '../internal/baseFlatten'; | ||
import isIndex from '../internal/isIndex'; | ||
import basePullAt from '../internal/basePullAt'; | ||
import restParam from '../function/restParam'; | ||
/** Used for native method references. */ | ||
var arrayProto = Array.prototype; | ||
/** Native method references. */ | ||
var splice = arrayProto.splice; | ||
/** | ||
@@ -42,13 +36,4 @@ * Removes elements from `array` corresponding to the given indexes and returns | ||
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); | ||
} | ||
} | ||
var result = baseAt(array, indexes); | ||
basePullAt(array, indexes.sort(baseCompareAscending)); | ||
return result; | ||
@@ -55,0 +40,0 @@ }); |
import baseCallback from '../internal/baseCallback'; | ||
import basePullAt from '../internal/basePullAt'; | ||
/** Used for native method references. */ | ||
var arrayProto = Array.prototype; | ||
/** Native method references. */ | ||
var splice = arrayProto.splice; | ||
/** | ||
@@ -49,5 +44,9 @@ * Removes all elements from `array` that `predicate` returns truthy for | ||
function remove(array, predicate, thisArg) { | ||
var result = []; | ||
if (!(array && array.length)) { | ||
return result; | ||
} | ||
var index = -1, | ||
length = array ? array.length : 0, | ||
result = []; | ||
indexes = [], | ||
length = array.length; | ||
@@ -59,6 +58,6 @@ predicate = baseCallback(predicate, thisArg, 3); | ||
result.push(value); | ||
splice.call(array, index--, 1); | ||
length--; | ||
indexes.push(index); | ||
} | ||
} | ||
basePullAt(array, indexes); | ||
return result; | ||
@@ -65,0 +64,0 @@ } |
@@ -7,3 +7,3 @@ import baseSlice from '../internal/baseSlice'; | ||
* | ||
* **Note:** This function is used instead of `Array#slice` to support node | ||
* **Note:** This method is used instead of `Array#slice` to support node | ||
* lists in IE < 9 and to ensure dense arrays are returned. | ||
@@ -10,0 +10,0 @@ * |
@@ -7,8 +7,9 @@ import baseCallback from '../internal/baseCallback'; | ||
/** | ||
* Creates a duplicate-value-free version of an array using `SameValueZero` | ||
* for equality comparisons. Providing `true` for `isSorted` performs a faster | ||
* search algorithm for sorted arrays. If an iteratee function is provided it | ||
* is invoked for each value in the array to generate the criterion by which | ||
* uniqueness is computed. The `iteratee` is bound to `thisArg` and invoked | ||
* with three arguments: (value, index, array). | ||
* Creates a duplicate-free version of an array, using `SameValueZero` for | ||
* equality comparisons, in which only the first occurence of each element | ||
* is kept. Providing `true` for `isSorted` performs a faster search algorithm | ||
* for sorted arrays. If an iteratee function is provided it is invoked for | ||
* each element in the array to generate the criterion by which uniqueness | ||
* is computed. The `iteratee` is bound to `thisArg` and invoked with three | ||
* arguments: (value, index, array). | ||
* | ||
@@ -41,4 +42,4 @@ * If a property name is provided for `iteratee` the created `_.property` | ||
* | ||
* _.uniq([1, 2, 1]); | ||
* // => [1, 2] | ||
* _.uniq([2, 1, 2]); | ||
* // => [2, 1] | ||
* | ||
@@ -45,0 +46,0 @@ * // using `isSorted` |
import arrayMap from '../internal/arrayMap'; | ||
import arrayMax from '../internal/arrayMax'; | ||
import baseProperty from '../internal/baseProperty'; | ||
import getLength from '../internal/getLength'; | ||
/** Used to the length of n-tuples for `_.unzip`. */ | ||
var getLength = baseProperty('length'); | ||
/** | ||
@@ -9,0 +7,0 @@ * This method is like `_.zip` except that it accepts an array of grouped |
@@ -53,4 +53,4 @@ import LazyWrapper from '../internal/LazyWrapper'; | ||
* `groupBy`, `indexBy`, `initial`, `intersection`, `invert`, `invoke`, `keys`, | ||
* `keysIn`, `map`, `mapValues`, `matches`, `matchesProperty`, `memoize`, `merge`, | ||
* `mixin`, `negate`, `noop`, `omit`, `once`, `pairs`, `partial`, `partialRight`, | ||
* `keysIn`, `map`, `mapValues`, `matches`, `matchesProperty`, `memoize`, | ||
* `merge`, `mixin`, `negate`, `omit`, `once`, `pairs`, `partial`, `partialRight`, | ||
* `partition`, `pick`, `plant`, `pluck`, `property`, `propertyOf`, `pull`, | ||
@@ -69,11 +69,11 @@ * `pullAt`, `push`, `range`, `rearg`, `reject`, `remove`, `rest`, `reverse`, | ||
* `identity`, `includes`, `indexOf`, `inRange`, `isArguments`, `isArray`, | ||
* `isBoolean`, `isDate`, `isElement`, `isEmpty`, `isEqual`, `isError`, | ||
* `isFinite`,`isFunction`, `isMatch`, `isNative`, `isNaN`, `isNull`, `isNumber`, | ||
* `isObject`, `isPlainObject`, `isRegExp`, `isString`, `isUndefined`, | ||
* `isTypedArray`, `join`, `kebabCase`, `last`, `lastIndexOf`, `max`, `min`, | ||
* `noConflict`, `now`, `pad`, `padLeft`, `padRight`, `parseInt`, `pop`, | ||
* `random`, `reduce`, `reduceRight`, `repeat`, `result`, `runInContext`, | ||
* `shift`, `size`, `snakeCase`, `some`, `sortedIndex`, `sortedLastIndex`, | ||
* `startCase`, `startsWith`, `sum`, `template`, `trim`, `trimLeft`, | ||
* `trimRight`, `trunc`, `unescape`, `uniqueId`, `value`, and `words` | ||
* `isBoolean`, `isDate`, `isElement`, `isEmpty`, `isEqual`, `isError`, `isFinite` | ||
* `isFunction`, `isMatch`, `isNative`, `isNaN`, `isNull`, `isNumber`, `isObject`, | ||
* `isPlainObject`, `isRegExp`, `isString`, `isUndefined`, `isTypedArray`, | ||
* `join`, `kebabCase`, `last`, `lastIndexOf`, `max`, `min`, `noConflict`, | ||
* `noop`, `now`, `pad`, `padLeft`, `padRight`, `parseInt`, `pop`, `random`, | ||
* `reduce`, `reduceRight`, `repeat`, `result`, `runInContext`, `shift`, `size`, | ||
* `snakeCase`, `some`, `sortedIndex`, `sortedLastIndex`, `startCase`, `startsWith`, | ||
* `sum`, `template`, `trim`, `trimLeft`, `trimRight`, `trunc`, `unescape`, | ||
* `uniqueId`, `value`, and `words` | ||
* | ||
@@ -93,4 +93,4 @@ * The wrapper method `sample` will return a wrapped value when `n` is provided, | ||
* // returns an unwrapped value | ||
* wrapped.reduce(function(sum, n) { | ||
* return sum + n; | ||
* wrapped.reduce(function(total, n) { | ||
* return total + n; | ||
* }); | ||
@@ -97,0 +97,0 @@ * // => 6 |
import baseAt from '../internal/baseAt'; | ||
import baseFlatten from '../internal/baseFlatten'; | ||
import getLength from '../internal/getLength'; | ||
import isLength from '../internal/isLength'; | ||
@@ -28,3 +29,3 @@ import restParam from '../function/restParam'; | ||
var at = restParam(function(collection, props) { | ||
var length = collection ? collection.length : 0; | ||
var length = collection ? getLength(collection) : 0; | ||
if (isLength(length)) { | ||
@@ -31,0 +32,0 @@ collection = toIterable(collection); |
@@ -60,3 +60,3 @@ import arrayEvery from '../internal/arrayEvery'; | ||
} | ||
if (typeof predicate != 'function' || typeof thisArg != 'undefined') { | ||
if (typeof predicate != 'function' || thisArg !== undefined) { | ||
predicate = baseCallback(predicate, thisArg, 3); | ||
@@ -63,0 +63,0 @@ } |
@@ -8,6 +8,6 @@ import arrayEach from '../internal/arrayEach'; | ||
* The `iteratee` is bound to `thisArg` and invoked with three arguments: | ||
* (value, index|key, collection). Iterator functions may exit iteration early | ||
* (value, index|key, collection). Iteratee functions may exit iteration early | ||
* by explicitly returning `false`. | ||
* | ||
* **Note:** As with other "Collections" methods, objects with a `length` property | ||
* **Note:** As with other "Collections" methods, objects with a "length" property | ||
* are iterated like arrays. To avoid this behavior `_.forIn` or `_.forOwn` | ||
@@ -14,0 +14,0 @@ * may be used for object iteration. |
import baseIndexOf from '../internal/baseIndexOf'; | ||
import getLength from '../internal/getLength'; | ||
import isArray from '../lang/isArray'; | ||
@@ -44,3 +45,3 @@ import isIterateeCall from '../internal/isIterateeCall'; | ||
function includes(collection, target, fromIndex, guard) { | ||
var length = collection ? collection.length : 0; | ||
var length = collection ? getLength(collection) : 0; | ||
if (!isLength(length)) { | ||
@@ -47,0 +48,0 @@ collection = values(collection); |
import baseEach from '../internal/baseEach'; | ||
import getLength from '../internal/getLength'; | ||
import invokePath from '../internal/invokePath'; | ||
import isKey from '../internal/isKey'; | ||
import isLength from '../internal/isLength'; | ||
@@ -6,6 +9,6 @@ import restParam from '../function/restParam'; | ||
/** | ||
* Invokes the method named by `methodName` on each element in `collection`, | ||
* returning an array of the results of each invoked method. Any additional | ||
* arguments are provided to each invoked method. If `methodName` is a function | ||
* it is invoked for, and `this` bound to, each element in `collection`. | ||
* Invokes the method at `path` on each element in `collection`, returning | ||
* an array of the results of each invoked method. Any additional arguments | ||
* are provided to each invoked method. If `methodName` is a function it is | ||
* invoked for, and `this` bound to, each element in `collection`. | ||
* | ||
@@ -16,3 +19,3 @@ * @static | ||
* @param {Array|Object|string} collection The collection to iterate over. | ||
* @param {Function|string} methodName The name of the method to invoke or | ||
* @param {Array|Function|string} path The path of the method to invoke or | ||
* the function invoked per iteration. | ||
@@ -29,11 +32,12 @@ * @param {...*} [args] The arguments to invoke the method with. | ||
*/ | ||
var invoke = restParam(function(collection, methodName, args) { | ||
var invoke = restParam(function(collection, path, args) { | ||
var index = -1, | ||
isFunc = typeof methodName == 'function', | ||
length = collection ? collection.length : 0, | ||
isFunc = typeof path == 'function', | ||
isProp = isKey(path), | ||
length = getLength(collection), | ||
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; | ||
var func = isFunc ? path : (isProp && value != null && value[path]); | ||
result[++index] = func ? func.apply(value, args) : invokePath(value, path, args); | ||
}); | ||
@@ -40,0 +44,0 @@ return result; |
@@ -38,3 +38,2 @@ import arrayMap from '../internal/arrayMap'; | ||
* per iteration. | ||
* create a `_.property` or `_.matches` style callback respectively. | ||
* @param {*} [thisArg] The `this` binding of `iteratee`. | ||
@@ -41,0 +40,0 @@ * @returns {Array} Returns the new mapped array. |
@@ -1,6 +0,6 @@ | ||
import baseProperty from '../internal/baseProperty'; | ||
import map from './map'; | ||
import property from '../utility/property'; | ||
/** | ||
* Gets the value of `key` from all elements in `collection`. | ||
* Gets the property value of `path` from all elements in `collection`. | ||
* | ||
@@ -11,3 +11,3 @@ * @static | ||
* @param {Array|Object|string} collection The collection to iterate over. | ||
* @param {string} key The key of the property to pluck. | ||
* @param {Array|string} path The path of the property to pluck. | ||
* @returns {Array} Returns the property values. | ||
@@ -28,6 +28,6 @@ * @example | ||
*/ | ||
function pluck(collection, key) { | ||
return map(collection, baseProperty(key)); | ||
function pluck(collection, path) { | ||
return map(collection, property(path)); | ||
} | ||
export default pluck; |
@@ -30,4 +30,4 @@ import arrayReduce from '../internal/arrayReduce'; | ||
* | ||
* _.reduce([1, 2], function(sum, n) { | ||
* return sum + n; | ||
* _.reduce([1, 2], function(total, n) { | ||
* return total + n; | ||
* }); | ||
@@ -34,0 +34,0 @@ * // => 3 |
@@ -0,1 +1,2 @@ | ||
import getLength from '../internal/getLength'; | ||
import isLength from '../internal/isLength'; | ||
@@ -25,3 +26,3 @@ import keys from '../object/keys'; | ||
function size(collection) { | ||
var length = collection ? collection.length : 0; | ||
var length = collection ? getLength(collection) : 0; | ||
return isLength(length) ? length : keys(collection).length; | ||
@@ -28,0 +29,0 @@ } |
@@ -61,3 +61,3 @@ import arraySome from '../internal/arraySome'; | ||
} | ||
if (typeof predicate != 'function' || typeof thisArg != 'undefined') { | ||
if (typeof predicate != 'function' || thisArg !== undefined) { | ||
predicate = baseCallback(predicate, thisArg, 3); | ||
@@ -64,0 +64,0 @@ } |
import baseCallback from '../internal/baseCallback'; | ||
import baseEach from '../internal/baseEach'; | ||
import baseMap from '../internal/baseMap'; | ||
import baseSortBy from '../internal/baseSortBy'; | ||
import compareAscending from '../internal/compareAscending'; | ||
import isIterateeCall from '../internal/isIterateeCall'; | ||
import isLength from '../internal/isLength'; | ||
@@ -30,5 +29,4 @@ /** | ||
* @param {Array|Object|string} collection The collection to iterate over. | ||
* @param {Array|Function|Object|string} [iteratee=_.identity] The function | ||
* invoked per iteration. If a property name or an object is provided it is | ||
* used to create a `_.property` or `_.matches` style callback respectively. | ||
* @param {Function|Object|string} [iteratee=_.identity] The function invoked | ||
* per iteration. | ||
* @param {*} [thisArg] The `this` binding of `iteratee`. | ||
@@ -62,12 +60,10 @@ * @returns {Array} Returns the new sorted array. | ||
} | ||
var index = -1, | ||
length = collection.length, | ||
result = isLength(length) ? Array(length) : []; | ||
if (thisArg && isIterateeCall(collection, iteratee, thisArg)) { | ||
iteratee = null; | ||
} | ||
var index = -1; | ||
iteratee = baseCallback(iteratee, thisArg, 3); | ||
baseEach(collection, function(value, key, collection) { | ||
result[++index] = { 'criteria': iteratee(value, key, collection), 'index': index, 'value': value }; | ||
var result = baseMap(collection, function(value, key, collection) { | ||
return { 'criteria': iteratee(value, key, collection), 'index': ++index, 'value': value }; | ||
}); | ||
@@ -74,0 +70,0 @@ return baseSortBy(result, compareAscending); |
import baseFlatten from '../internal/baseFlatten'; | ||
import baseSortByOrder from '../internal/baseSortByOrder'; | ||
import isIterateeCall from '../internal/isIterateeCall'; | ||
import restParam from '../function/restParam'; | ||
/** | ||
* This method is like `_.sortBy` except that it sorts by property names | ||
* instead of an iteratee function. | ||
* This method is like `_.sortBy` except that it can sort by multiple iteratees | ||
* or property names. | ||
* | ||
* If a property name is provided for an iteratee the created `_.property` | ||
* style callback returns the property value of the given element. | ||
* | ||
* If an object is provided for an iteratee the created `_.matches` style | ||
* callback returns `true` for elements that have the properties of the given | ||
* object, else `false`. | ||
* | ||
* @static | ||
@@ -13,4 +21,4 @@ * @memberOf _ | ||
* @param {Array|Object|string} collection The collection to iterate over. | ||
* @param {...(string|string[])} props The property names to sort by, | ||
* specified as individual property names or arrays of property names. | ||
* @param {...(Function|Function[]|Object|Object[]|string|string[])} iteratees | ||
* The iteratees to sort by, specified as individual values or arrays of values. | ||
* @returns {Array} Returns the new sorted array. | ||
@@ -20,31 +28,27 @@ * @example | ||
* var users = [ | ||
* { 'user': 'fred', 'age': 48 }, | ||
* { 'user': 'barney', 'age': 36 }, | ||
* { 'user': 'fred', 'age': 40 }, | ||
* { 'user': 'barney', 'age': 26 }, | ||
* { 'user': 'fred', 'age': 30 } | ||
* { 'user': 'fred', 'age': 42 }, | ||
* { 'user': 'barney', 'age': 34 } | ||
* ]; | ||
* | ||
* _.map(_.sortByAll(users, ['user', 'age']), _.values); | ||
* // => [['barney', 26], ['barney', 36], ['fred', 30], ['fred', 40]] | ||
* // => [['barney', 34], ['barney', 36], ['fred', 42], ['fred', 48]] | ||
* | ||
* _.map(_.sortByAll(users, 'user', function(chr) { | ||
* return Math.floor(chr.age / 10); | ||
* }), _.values); | ||
* // => [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] | ||
*/ | ||
function sortByAll() { | ||
var args = arguments, | ||
collection = args[0], | ||
guard = args[3], | ||
index = 0, | ||
length = args.length - 1; | ||
var sortByAll = restParam(function(collection, iteratees) { | ||
if (collection == null) { | ||
return []; | ||
} | ||
var props = Array(length); | ||
while (index < length) { | ||
props[index] = args[++index]; | ||
var guard = iteratees[2]; | ||
if (guard && isIterateeCall(iteratees[0], iteratees[1], guard)) { | ||
iteratees.length = 1; | ||
} | ||
if (guard && isIterateeCall(args[1], args[2], guard)) { | ||
props = args[1]; | ||
} | ||
return baseSortByOrder(collection, baseFlatten(props), []); | ||
} | ||
return baseSortByOrder(collection, baseFlatten(iteratees), []); | ||
}); | ||
export default sortByAll; |
@@ -7,6 +7,13 @@ import baseSortByOrder from '../internal/baseSortByOrder'; | ||
* This method is like `_.sortByAll` except that it allows specifying the | ||
* sort orders of the property names to sort by. A truthy value in `orders` | ||
* will sort the corresponding property name in ascending order while a | ||
* falsey value will sort it in descending order. | ||
* sort orders of the iteratees to sort by. A truthy value in `orders` will | ||
* sort the corresponding property name in ascending order while a falsey | ||
* value will sort it in descending order. | ||
* | ||
* If a property name is provided for an iteratee the created `_.property` | ||
* style callback returns the property value of the given element. | ||
* | ||
* If an object is provided for an iteratee the created `_.matches` style | ||
* callback returns `true` for elements that have the properties of the given | ||
* object, else `false`. | ||
* | ||
* @static | ||
@@ -16,4 +23,4 @@ * @memberOf _ | ||
* @param {Array|Object|string} collection The collection to iterate over. | ||
* @param {string[]} props The property names to sort by. | ||
* @param {boolean[]} orders The sort orders of `props`. | ||
* @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by. | ||
* @param {boolean[]} orders The sort orders of `iteratees`. | ||
* @param- {Object} [guard] Enables use as a callback for functions like `_.reduce`. | ||
@@ -24,6 +31,6 @@ * @returns {Array} Returns the new sorted array. | ||
* var users = [ | ||
* { 'user': 'barney', 'age': 26 }, | ||
* { 'user': 'fred', 'age': 40 }, | ||
* { 'user': 'barney', 'age': 36 }, | ||
* { 'user': 'fred', 'age': 30 } | ||
* { 'user': 'fred', 'age': 48 }, | ||
* { 'user': 'barney', 'age': 34 }, | ||
* { 'user': 'fred', 'age': 42 }, | ||
* { 'user': 'barney', 'age': 36 } | ||
* ]; | ||
@@ -33,13 +40,13 @@ * | ||
* _.map(_.sortByOrder(users, ['user', 'age'], [true, false]), _.values); | ||
* // => [['barney', 36], ['barney', 26], ['fred', 40], ['fred', 30]] | ||
* // => [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] | ||
*/ | ||
function sortByOrder(collection, props, orders, guard) { | ||
function sortByOrder(collection, iteratees, orders, guard) { | ||
if (collection == null) { | ||
return []; | ||
} | ||
if (guard && isIterateeCall(props, orders, guard)) { | ||
if (guard && isIterateeCall(iteratees, orders, guard)) { | ||
orders = null; | ||
} | ||
if (!isArray(props)) { | ||
props = props == null ? [] : [props]; | ||
if (!isArray(iteratees)) { | ||
iteratees = iteratees == null ? [] : [iteratees]; | ||
} | ||
@@ -49,5 +56,5 @@ if (!isArray(orders)) { | ||
} | ||
return baseSortByOrder(collection, props, orders); | ||
return baseSortByOrder(collection, iteratees, orders); | ||
} | ||
export default sortByOrder; |
@@ -34,3 +34,4 @@ /** Used as the `TypeError` message for "Functions" methods. */ | ||
result = func.apply(this, arguments); | ||
} else { | ||
} | ||
if (n <= 1) { | ||
func = null; | ||
@@ -37,0 +38,0 @@ } |
@@ -17,3 +17,3 @@ import createWrapper from '../internal/createWrapper'; | ||
* | ||
* **Note:** Unlike native `Function#bind` this method does not set the `length` | ||
* **Note:** Unlike native `Function#bind` this method does not set the "length" | ||
* property of bound functions. | ||
@@ -20,0 +20,0 @@ * |
@@ -15,3 +15,3 @@ import baseFlatten from '../internal/baseFlatten'; | ||
* | ||
* **Note:** This method does not set the `length` property of bound functions. | ||
* **Note:** This method does not set the "length" property of bound functions. | ||
* | ||
@@ -18,0 +18,0 @@ * @static |
@@ -16,3 +16,3 @@ import createWrapper from '../internal/createWrapper'; | ||
* methods that may be redefined or don't yet exist. | ||
* See [Peter Michaux's article](http://michaux.ca/articles/lazy-function-definition-pattern) | ||
* See [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern) | ||
* for more details. | ||
@@ -19,0 +19,0 @@ * |
@@ -16,3 +16,3 @@ import createCurry from '../internal/createCurry'; | ||
* | ||
* **Note:** This method does not set the `length` property of curried functions. | ||
* **Note:** This method does not set the "length" property of curried functions. | ||
* | ||
@@ -19,0 +19,0 @@ * @static |
@@ -13,3 +13,3 @@ import createCurry from '../internal/createCurry'; | ||
* | ||
* **Note:** This method does not set the `length` property of curried functions. | ||
* **Note:** This method does not set the "length" property of curried functions. | ||
* | ||
@@ -16,0 +16,0 @@ * @static |
@@ -21,5 +21,5 @@ import before from './before'; | ||
function once(func) { | ||
return before(func, 2); | ||
return before(2, func); | ||
} | ||
export default once; |
@@ -14,3 +14,3 @@ import createPartial from '../internal/createPartial'; | ||
* | ||
* **Note:** This method does not set the `length` property of partially | ||
* **Note:** This method does not set the "length" property of partially | ||
* applied functions. | ||
@@ -17,0 +17,0 @@ * |
@@ -13,3 +13,3 @@ import createPartial from '../internal/createPartial'; | ||
* | ||
* **Note:** This method does not set the `length` property of partially | ||
* **Note:** This method does not set the "length" property of partially | ||
* applied functions. | ||
@@ -16,0 +16,0 @@ * |
@@ -33,3 +33,3 @@ /** Used as the `TypeError` message for "Functions" methods. */ | ||
} | ||
start = nativeMax(typeof start == 'undefined' ? (func.length - 1) : (+start || 0), 0); | ||
start = nativeMax(start === undefined ? (func.length - 1) : (+start || 0), 0); | ||
return function() { | ||
@@ -36,0 +36,0 @@ var args = arguments, |
@@ -10,5 +10,5 @@ /** | ||
function assignDefaults(objectValue, sourceValue) { | ||
return typeof objectValue == 'undefined' ? sourceValue : objectValue; | ||
return objectValue === undefined ? sourceValue : objectValue; | ||
} | ||
export default assignDefaults; |
@@ -10,3 +10,3 @@ /** Used for native method references. */ | ||
* | ||
* **Note:** This method is like `assignDefaults` except that it ignores | ||
* **Note:** This function is like `assignDefaults` except that it ignores | ||
* inherited property values when checking if a property is `undefined`. | ||
@@ -22,3 +22,3 @@ * | ||
function assignOwnDefaults(objectValue, sourceValue, key, object) { | ||
return (typeof objectValue == 'undefined' || !hasOwnProperty.call(object, key)) | ||
return (objectValue === undefined || !hasOwnProperty.call(object, key)) | ||
? sourceValue | ||
@@ -25,0 +25,0 @@ : objectValue; |
import baseCopy from './baseCopy'; | ||
import getSymbols from './getSymbols'; | ||
import isNative from '../lang/isNative'; | ||
import keys from '../object/keys'; | ||
/** Native method references. */ | ||
var preventExtensions = isNative(Object.preventExtensions = Object.preventExtensions) && preventExtensions; | ||
/** Used as `baseAssign`. */ | ||
var nativeAssign = (function() { | ||
// Avoid `Object.assign` in Firefox 34-37 which have an early implementation | ||
// with a now defunct try/catch behavior. See https://bugzilla.mozilla.org/show_bug.cgi?id=1103344 | ||
// for more details. | ||
// | ||
// Use `Object.preventExtensions` on a plain object instead of simply using | ||
// `Object('x')` because Chrome and IE fail to throw an error when attempting | ||
// to assign values to readonly indexes of strings in strict mode. | ||
var object = { '1': 0 }, | ||
func = preventExtensions && isNative(func = Object.assign) && func; | ||
try { func(preventExtensions(object), 'xo'); } catch(e) {} | ||
return !object[1] && func; | ||
}()); | ||
/** | ||
* The base implementation of `_.assign` without support for argument juggling, | ||
* multiple sources, and `this` binding `customizer` functions. | ||
* multiple sources, and `customizer` functions. | ||
* | ||
@@ -11,26 +32,10 @@ * @private | ||
* @param {Object} source The source object. | ||
* @param {Function} [customizer] The function to customize assigning values. | ||
* @returns {Object} Returns the destination object. | ||
* @returns {Object} Returns `object`. | ||
*/ | ||
function baseAssign(object, source, customizer) { | ||
var props = keys(source); | ||
if (!customizer) { | ||
return baseCopy(source, object, props); | ||
} | ||
var index = -1, | ||
length = props.length; | ||
var baseAssign = nativeAssign || function(object, source) { | ||
return source == null | ||
? object | ||
: baseCopy(source, getSymbols(source), baseCopy(source, keys(source), object)); | ||
}; | ||
while (++index < length) { | ||
var key = props[index], | ||
value = object[key], | ||
result = customizer(value, source[key], key, object, source); | ||
if ((result === result ? (result !== value) : (value === value)) || | ||
(typeof value == 'undefined' && !(key in object))) { | ||
object[key] = result; | ||
} | ||
} | ||
return object; | ||
} | ||
export default baseAssign; |
@@ -5,8 +5,8 @@ import isIndex from './isIndex'; | ||
/** | ||
* The base implementation of `_.at` without support for strings and individual | ||
* key arguments. | ||
* The base implementation of `_.at` without support for string collections | ||
* and individual key arguments. | ||
* | ||
* @private | ||
* @param {Array|Object} collection The collection to iterate over. | ||
* @param {number[]|string[]} [props] The property names or indexes of elements to pick. | ||
* @param {number[]|string[]} props The property names or indexes of elements to pick. | ||
* @returns {Array} Returns the new array of picked elements. | ||
@@ -24,3 +24,2 @@ */ | ||
if (isArr) { | ||
key = parseFloat(key); | ||
result[index] = isIndex(key, length) ? collection[key] : undefined; | ||
@@ -27,0 +26,0 @@ } else { |
import baseMatches from './baseMatches'; | ||
import baseMatchesProperty from './baseMatchesProperty'; | ||
import baseProperty from './baseProperty'; | ||
import bindCallback from './bindCallback'; | ||
import identity from '../utility/identity'; | ||
import property from '../utility/property'; | ||
@@ -20,3 +20,3 @@ /** | ||
if (type == 'function') { | ||
return typeof thisArg == 'undefined' | ||
return thisArg === undefined | ||
? func | ||
@@ -31,7 +31,7 @@ : bindCallback(func, thisArg, argCount); | ||
} | ||
return typeof thisArg == 'undefined' | ||
? baseProperty(func + '') | ||
: baseMatchesProperty(func + '', thisArg); | ||
return thisArg === undefined | ||
? property(func) | ||
: baseMatchesProperty(func, thisArg); | ||
} | ||
export default baseCallback; |
import arrayCopy from './arrayCopy'; | ||
import arrayEach from './arrayEach'; | ||
import baseCopy from './baseCopy'; | ||
import baseAssign from './baseAssign'; | ||
import baseForOwn from './baseForOwn'; | ||
@@ -10,3 +10,2 @@ import initCloneArray from './initCloneArray'; | ||
import isObject from '../lang/isObject'; | ||
import keys from '../object/keys'; | ||
@@ -82,3 +81,3 @@ /** `Object#toString` result references. */ | ||
} | ||
if (typeof result != 'undefined') { | ||
if (result !== undefined) { | ||
return result; | ||
@@ -102,3 +101,3 @@ } | ||
if (!isDeep) { | ||
return baseCopy(value, result, keys(value)); | ||
return baseAssign(result, value); | ||
} | ||
@@ -105,0 +104,0 @@ } else { |
@@ -15,6 +15,6 @@ /** | ||
if (value > other || !valIsReflexive || (typeof value == 'undefined' && othIsReflexive)) { | ||
if (value > other || !valIsReflexive || (value === undefined && othIsReflexive)) { | ||
return 1; | ||
} | ||
if (value < other || !othIsReflexive || (typeof other == 'undefined' && valIsReflexive)) { | ||
if (value < other || !othIsReflexive || (other === undefined && valIsReflexive)) { | ||
return -1; | ||
@@ -21,0 +21,0 @@ } |
/** | ||
* Copies the properties of `source` to `object`. | ||
* Copies properties of `source` to `object`. | ||
* | ||
* @private | ||
* @param {Object} source The object to copy properties from. | ||
* @param {Array} props The property names to copy. | ||
* @param {Object} [object={}] The object to copy properties to. | ||
* @param {Array} props The property names to copy. | ||
* @returns {Object} Returns `object`. | ||
*/ | ||
function baseCopy(source, object, props) { | ||
if (!props) { | ||
props = object; | ||
object = {}; | ||
} | ||
function baseCopy(source, props, object) { | ||
object || (object = {}); | ||
var index = -1, | ||
@@ -16,0 +14,0 @@ length = props.length; |
@@ -18,3 +18,3 @@ /** | ||
} | ||
end = (typeof end == 'undefined' || end > length) ? length : (+end || 0); | ||
end = (end === undefined || end > length) ? length : (+end || 0); | ||
if (end < 0) { | ||
@@ -21,0 +21,0 @@ end += length; |
@@ -6,3 +6,3 @@ import createBaseFor from './createBaseFor'; | ||
* over `object` properties returned by `keysFunc` invoking `iteratee` for | ||
* each property. Iterator functions may exit iteration early by explicitly | ||
* each property. Iteratee functions may exit iteration early by explicitly | ||
* returning `false`. | ||
@@ -9,0 +9,0 @@ * |
@@ -10,3 +10,2 @@ import equalArrays from './equalArrays'; | ||
arrayTag = '[object Array]', | ||
funcTag = '[object Function]', | ||
objectTag = '[object Object]'; | ||
@@ -63,4 +62,4 @@ | ||
} | ||
var objIsObj = (objTag == objectTag || (isLoose && objTag == funcTag)), | ||
othIsObj = (othTag == objectTag || (isLoose && othTag == funcTag)), | ||
var objIsObj = objTag == objectTag, | ||
othIsObj = othTag == objectTag, | ||
isSameTag = objTag == othTag; | ||
@@ -71,7 +70,3 @@ | ||
} | ||
if (isLoose) { | ||
if (!isSameTag && !(objIsObj && othIsObj)) { | ||
return false; | ||
} | ||
} else { | ||
if (!isLoose) { | ||
var valWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), | ||
@@ -83,6 +78,6 @@ othWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); | ||
} | ||
if (!isSameTag) { | ||
return false; | ||
} | ||
} | ||
if (!isSameTag) { | ||
return false; | ||
} | ||
// Assume cyclic values are equal. | ||
@@ -89,0 +84,0 @@ // For more information on detecting circular references see https://es5.github.io/#JO. |
@@ -35,6 +35,6 @@ import baseIsEqual from './baseIsEqual'; | ||
if (noCustomizer && strictCompareFlags[index]) { | ||
var result = typeof objValue != 'undefined' || (key in object); | ||
var result = objValue !== undefined || (key in object); | ||
} else { | ||
result = customizer ? customizer(objValue, srcValue, key) : undefined; | ||
if (typeof result == 'undefined') { | ||
if (result === undefined) { | ||
result = baseIsEqual(srcValue, objValue, customizer, true); | ||
@@ -41,0 +41,0 @@ } |
import baseEach from './baseEach'; | ||
import getLength from './getLength'; | ||
import isLength from './isLength'; | ||
@@ -13,5 +15,8 @@ /** | ||
function baseMap(collection, iteratee) { | ||
var result = []; | ||
var index = -1, | ||
length = getLength(collection), | ||
result = isLength(length) ? Array(length) : []; | ||
baseEach(collection, function(value, key, collection) { | ||
result.push(iteratee(value, key, collection)); | ||
result[++index] = iteratee(value, key, collection); | ||
}); | ||
@@ -18,0 +23,0 @@ return result; |
@@ -27,4 +27,6 @@ import baseIsMatch from './baseIsMatch'; | ||
return function(object) { | ||
return object != null && object[key] === value && | ||
(typeof value != 'undefined' || (key in toObject(object))); | ||
if (object == null) { | ||
return false; | ||
} | ||
return object[key] === value && (value !== undefined || (key in toObject(object))); | ||
}; | ||
@@ -31,0 +33,0 @@ } |
@@ -0,23 +1,43 @@ | ||
import baseGet from './baseGet'; | ||
import baseIsEqual from './baseIsEqual'; | ||
import baseSlice from './baseSlice'; | ||
import isArray from '../lang/isArray'; | ||
import isKey from './isKey'; | ||
import isStrictComparable from './isStrictComparable'; | ||
import last from '../array/last'; | ||
import toObject from './toObject'; | ||
import toPath from './toPath'; | ||
/** | ||
* The base implementation of `_.matchesProperty` which does not coerce `key` | ||
* to a string. | ||
* The base implementation of `_.matchesProperty` which does not which does | ||
* not clone `value`. | ||
* | ||
* @private | ||
* @param {string} key The key of the property to get. | ||
* @param {string} path The path of the property to get. | ||
* @param {*} value The value to compare. | ||
* @returns {Function} Returns the new function. | ||
*/ | ||
function baseMatchesProperty(key, value) { | ||
if (isStrictComparable(value)) { | ||
return function(object) { | ||
return object != null && object[key] === value && | ||
(typeof value != 'undefined' || (key in toObject(object))); | ||
}; | ||
} | ||
function baseMatchesProperty(path, value) { | ||
var isArr = isArray(path), | ||
isCommon = isKey(path) && isStrictComparable(value), | ||
pathKey = (path + ''); | ||
path = toPath(path); | ||
return function(object) { | ||
return object != null && baseIsEqual(value, object[key], null, true); | ||
if (object == null) { | ||
return false; | ||
} | ||
var key = pathKey; | ||
object = toObject(object); | ||
if ((isArr || !isCommon) && !(key in object)) { | ||
object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1)); | ||
if (object == null) { | ||
return false; | ||
} | ||
key = last(path); | ||
object = toObject(object); | ||
} | ||
return object[key] === value | ||
? (value !== undefined || (key in object)) | ||
: baseIsEqual(value, object[key], null, true); | ||
}; | ||
@@ -24,0 +44,0 @@ } |
import arrayEach from './arrayEach'; | ||
import baseForOwn from './baseForOwn'; | ||
import baseMergeDeep from './baseMergeDeep'; | ||
import getSymbols from './getSymbols'; | ||
import isArray from '../lang/isArray'; | ||
@@ -9,3 +9,10 @@ import isLength from './isLength'; | ||
import isTypedArray from '../lang/isTypedArray'; | ||
import keys from '../object/keys'; | ||
/** Used for native method references. */ | ||
var arrayProto = Array.prototype; | ||
/** Native method references. */ | ||
var push = arrayProto.push; | ||
/** | ||
@@ -21,3 +28,3 @@ * The base implementation of `_.merge` without support for argument juggling, | ||
* @param {Array} [stackB=[]] Associates values with source counterparts. | ||
* @returns {Object} Returns the destination object. | ||
* @returns {Object} Returns `object`. | ||
*/ | ||
@@ -29,19 +36,29 @@ function baseMerge(object, source, customizer, stackA, stackB) { | ||
var isSrcArr = isLength(source.length) && (isArray(source) || isTypedArray(source)); | ||
(isSrcArr ? arrayEach : baseForOwn)(source, function(srcValue, key, source) { | ||
if (!isSrcArr) { | ||
var props = keys(source); | ||
push.apply(props, getSymbols(source)); | ||
} | ||
arrayEach(props || source, function(srcValue, key) { | ||
if (props) { | ||
key = srcValue; | ||
srcValue = source[key]; | ||
} | ||
if (isObjectLike(srcValue)) { | ||
stackA || (stackA = []); | ||
stackB || (stackB = []); | ||
return baseMergeDeep(object, source, key, baseMerge, customizer, stackA, stackB); | ||
baseMergeDeep(object, source, key, baseMerge, customizer, stackA, stackB); | ||
} | ||
var value = object[key], | ||
result = customizer ? customizer(value, srcValue, key, object, source) : undefined, | ||
isCommon = typeof result == 'undefined'; | ||
else { | ||
var value = object[key], | ||
result = customizer ? customizer(value, srcValue, key, object, source) : undefined, | ||
isCommon = result === undefined; | ||
if (isCommon) { | ||
result = srcValue; | ||
if (isCommon) { | ||
result = srcValue; | ||
} | ||
if ((isSrcArr || result !== undefined) && | ||
(isCommon || (result === result ? (result !== value) : (value === value)))) { | ||
object[key] = result; | ||
} | ||
} | ||
if ((isSrcArr || typeof result != 'undefined') && | ||
(isCommon || (result === result ? (result !== value) : (value === value)))) { | ||
object[key] = result; | ||
} | ||
}); | ||
@@ -48,0 +65,0 @@ return object; |
import arrayCopy from './arrayCopy'; | ||
import getLength from './getLength'; | ||
import isArguments from '../lang/isArguments'; | ||
@@ -36,3 +37,3 @@ import isArray from '../lang/isArray'; | ||
result = customizer ? customizer(value, srcValue, key, object, source) : undefined, | ||
isCommon = typeof result == 'undefined'; | ||
isCommon = result === undefined; | ||
@@ -44,3 +45,3 @@ if (isCommon) { | ||
? value | ||
: ((value && value.length) ? arrayCopy(value) : []); | ||
: (getLength(value) ? arrayCopy(value) : []); | ||
} | ||
@@ -47,0 +48,0 @@ else if (isPlainObject(srcValue) || isArguments(srcValue)) { |
/** | ||
* The base implementation of `_.property` which does not coerce `key` to a string. | ||
* The base implementation of `_.property` without support for deep paths. | ||
* | ||
@@ -4,0 +4,0 @@ * @private |
@@ -18,3 +18,3 @@ /** | ||
} | ||
end = (typeof end == 'undefined' || end > length) ? length : (+end || 0); | ||
end = (end === undefined || end > length) ? length : (+end || 0); | ||
if (end < 0) { | ||
@@ -21,0 +21,0 @@ end += length; |
@@ -1,5 +0,6 @@ | ||
import baseEach from './baseEach'; | ||
import arrayMap from './arrayMap'; | ||
import baseCallback from './baseCallback'; | ||
import baseMap from './baseMap'; | ||
import baseSortBy from './baseSortBy'; | ||
import compareMultiple from './compareMultiple'; | ||
import isLength from './isLength'; | ||
@@ -11,19 +12,14 @@ /** | ||
* @param {Array|Object|string} collection The collection to iterate over. | ||
* @param {string[]} props The property names to sort by. | ||
* @param {boolean[]} orders The sort orders of `props`. | ||
* @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by. | ||
* @param {boolean[]} orders The sort orders of `iteratees`. | ||
* @returns {Array} Returns the new sorted array. | ||
*/ | ||
function baseSortByOrder(collection, props, orders) { | ||
var index = -1, | ||
length = collection.length, | ||
result = isLength(length) ? Array(length) : []; | ||
function baseSortByOrder(collection, iteratees, orders) { | ||
var index = -1; | ||
baseEach(collection, function(value) { | ||
var length = props.length, | ||
criteria = Array(length); | ||
iteratees = arrayMap(iteratees, function(iteratee) { return baseCallback(iteratee); }); | ||
while (length--) { | ||
criteria[length] = value == null ? undefined : value[props[length]]; | ||
} | ||
result[++index] = { 'criteria': criteria, 'index': index, 'value': value }; | ||
var result = baseMap(collection, function(value) { | ||
var criteria = arrayMap(iteratees, function(iteratee) { return iteratee(value); }); | ||
return { 'criteria': criteria, 'index': ++index, 'value': value }; | ||
}); | ||
@@ -30,0 +26,0 @@ |
/** | ||
* The base implementation of `_.values` and `_.valuesIn` which creates an | ||
* array of `object` property values corresponding to the property names | ||
* returned by `keysFunc`. | ||
* of `props`. | ||
* | ||
@@ -6,0 +6,0 @@ * @private |
@@ -30,3 +30,3 @@ /** Native method references. */ | ||
valIsNaN = value !== value, | ||
valIsUndef = typeof value == 'undefined'; | ||
valIsUndef = value === undefined; | ||
@@ -41,3 +41,3 @@ while (low < high) { | ||
} else if (valIsUndef) { | ||
setLow = isReflexive && (retHighest || typeof computed != 'undefined'); | ||
setLow = isReflexive && (retHighest || computed !== undefined); | ||
} else { | ||
@@ -44,0 +44,0 @@ setLow = retHighest ? (computed <= value) : (computed < value); |
@@ -17,3 +17,3 @@ import identity from '../utility/identity'; | ||
} | ||
if (typeof thisArg == 'undefined') { | ||
if (thisArg === undefined) { | ||
return func; | ||
@@ -20,0 +20,0 @@ } |
@@ -7,3 +7,3 @@ import baseCompareAscending from './baseCompareAscending'; | ||
* | ||
* If orders is unspecified, sort in ascending order for all properties. | ||
* If `orders` is unspecified, sort in ascending order for all properties. | ||
* Otherwise, for each property, sort in ascending order if its corresponding value in | ||
@@ -10,0 +10,0 @@ * orders is true, and descending order if false. |
import bindCallback from './bindCallback'; | ||
import isIterateeCall from './isIterateeCall'; | ||
import restParam from '../function/restParam'; | ||
@@ -15,28 +16,22 @@ /** | ||
function createAssigner(assigner) { | ||
return function() { | ||
var args = arguments, | ||
length = args.length, | ||
object = args[0]; | ||
return restParam(function(object, sources) { | ||
var index = -1, | ||
length = object == null ? 0 : sources.length, | ||
customizer = length > 2 && sources[length - 2], | ||
guard = length > 2 && sources[2], | ||
thisArg = length > 1 && sources[length - 1]; | ||
if (length < 2 || object == null) { | ||
return object; | ||
} | ||
var customizer = args[length - 2], | ||
thisArg = args[length - 1], | ||
guard = args[3]; | ||
if (length > 3 && typeof customizer == 'function') { | ||
if (typeof customizer == 'function') { | ||
customizer = bindCallback(customizer, thisArg, 5); | ||
length -= 2; | ||
} else { | ||
customizer = (length > 2 && typeof thisArg == 'function') ? thisArg : null; | ||
customizer = typeof thisArg == 'function' ? thisArg : null; | ||
length -= (customizer ? 1 : 0); | ||
} | ||
if (guard && isIterateeCall(args[1], args[2], guard)) { | ||
customizer = length == 3 ? null : customizer; | ||
length = 2; | ||
if (guard && isIterateeCall(sources[0], sources[1], guard)) { | ||
customizer = length < 3 ? null : customizer; | ||
length = 1; | ||
} | ||
var index = 0; | ||
while (++index < length) { | ||
var source = args[index]; | ||
var source = sources[index]; | ||
if (source) { | ||
@@ -47,5 +42,5 @@ assigner(object, source, customizer); | ||
return object; | ||
}; | ||
}); | ||
} | ||
export default createAssigner; |
@@ -0,1 +1,2 @@ | ||
import getLength from './getLength'; | ||
import isLength from './isLength'; | ||
@@ -14,3 +15,3 @@ import toObject from './toObject'; | ||
return function(collection, iteratee) { | ||
var length = collection ? collection.length : 0; | ||
var length = collection ? getLength(collection) : 0; | ||
if (!isLength(length)) { | ||
@@ -17,0 +18,0 @@ return eachFunc(collection, iteratee); |
@@ -14,3 +14,3 @@ import bindCallback from './bindCallback'; | ||
return function(collection, iteratee, thisArg) { | ||
return (typeof iteratee == 'function' && typeof thisArg == 'undefined' && isArray(collection)) | ||
return (typeof iteratee == 'function' && thisArg === undefined && isArray(collection)) | ||
? arrayFunc(collection, iteratee) | ||
@@ -17,0 +17,0 @@ : eachFunc(collection, bindCallback(iteratee, thisArg, 3)); |
@@ -13,3 +13,3 @@ import bindCallback from './bindCallback'; | ||
return function(object, iteratee, thisArg) { | ||
if (typeof iteratee != 'function' || typeof thisArg != 'undefined') { | ||
if (typeof iteratee != 'function' || thisArg !== undefined) { | ||
iteratee = bindCallback(iteratee, thisArg, 3); | ||
@@ -16,0 +16,0 @@ } |
@@ -12,3 +12,3 @@ import bindCallback from './bindCallback'; | ||
return function(object, iteratee, thisArg) { | ||
if (typeof iteratee != 'function' || typeof thisArg != 'undefined') { | ||
if (typeof iteratee != 'function' || thisArg !== undefined) { | ||
iteratee = bindCallback(iteratee, thisArg, 3); | ||
@@ -15,0 +15,0 @@ } |
@@ -16,3 +16,3 @@ import baseCallback from './baseCallback'; | ||
var initFromArray = arguments.length < 3; | ||
return (typeof iteratee == 'function' && typeof thisArg == 'undefined' && isArray(collection)) | ||
return (typeof iteratee == 'function' && thisArg === undefined && isArray(collection)) | ||
? arrayFunc(collection, iteratee, accumulator, initFromArray) | ||
@@ -19,0 +19,0 @@ : baseReduce(collection, baseCallback(iteratee, thisArg, 4), accumulator, initFromArray, eachFunc); |
@@ -35,3 +35,3 @@ /** | ||
} | ||
if (typeof result == 'undefined') { | ||
if (result === undefined) { | ||
// Recursively compare arrays (susceptible to call stack limits). | ||
@@ -38,0 +38,0 @@ if (isLoose) { |
@@ -49,3 +49,3 @@ import keys from '../object/keys'; | ||
} | ||
if (typeof result == 'undefined') { | ||
if (result === undefined) { | ||
// Recursively compare objects (susceptible to call stack limits). | ||
@@ -52,0 +52,0 @@ result = (objValue && objValue === othValue) || equalFunc(objValue, othValue, customizer, isLoose, stackA, stackB); |
@@ -30,3 +30,2 @@ import bufferClone from './bufferClone'; | ||
* | ||
* | ||
* @private | ||
@@ -33,0 +32,0 @@ * @param {Object} object The object to clone. |
@@ -0,1 +1,2 @@ | ||
import getLength from './getLength'; | ||
import isIndex from './isIndex'; | ||
@@ -20,3 +21,3 @@ import isLength from './isLength'; | ||
if (type == 'number') { | ||
var length = object.length, | ||
var length = getLength(object), | ||
prereq = isLength(length) && isIndex(index, length); | ||
@@ -23,0 +24,0 @@ } else { |
/** | ||
* Adds `value` to `key` of the cache. | ||
* Sets `value` to `key` of the cache. | ||
* | ||
@@ -4,0 +4,0 @@ * @private |
@@ -5,3 +5,3 @@ import toObject from './toObject'; | ||
* A specialized version of `_.pick` that picks `object` properties specified | ||
* by the `props` array. | ||
* by `props`. | ||
* | ||
@@ -8,0 +8,0 @@ * @private |
@@ -14,3 +14,3 @@ /** Used to determine if values are of the language type `Object`. */ | ||
/** Detect free variable `global` from Node.js. */ | ||
var freeGlobal = freeExports && freeModule && typeof global == 'object' && global; | ||
var freeGlobal = freeExports && freeModule && typeof global == 'object' && global && global.Object && global; | ||
@@ -17,0 +17,0 @@ /** Detect free variable `self`. */ |
@@ -47,5 +47,5 @@ import baseForIn from './baseForIn'; | ||
}); | ||
return typeof result == 'undefined' || hasOwnProperty.call(value, result); | ||
return result === undefined || hasOwnProperty.call(value, result); | ||
} | ||
export default shimIsPlainObject; |
@@ -19,3 +19,3 @@ import isArguments from '../lang/isArguments'; | ||
* @private | ||
* @param {Object} object The object to inspect. | ||
* @param {Object} object The object to query. | ||
* @returns {Array} Returns the array of property names. | ||
@@ -22,0 +22,0 @@ */ |
@@ -0,1 +1,2 @@ | ||
import getLength from './getLength'; | ||
import isLength from './isLength'; | ||
@@ -16,3 +17,3 @@ import isObject from '../lang/isObject'; | ||
} | ||
if (!isLength(value.length)) { | ||
if (!isLength(getLength(value))) { | ||
return values(value); | ||
@@ -19,0 +20,0 @@ } |
@@ -0,1 +1,2 @@ | ||
import getLength from '../internal/getLength'; | ||
import isArguments from './isArguments'; | ||
@@ -40,3 +41,3 @@ import isArray from './isArray'; | ||
} | ||
var length = value.length; | ||
var length = getLength(value); | ||
if (isLength(length) && (isArray(value) || isString(value) || isArguments(value) || | ||
@@ -43,0 +44,0 @@ (isObjectLike(value) && isFunction(value.splice)))) { |
@@ -23,3 +23,3 @@ import baseIsEqual from '../internal/baseIsEqual'; | ||
* @param {*} other The other value to compare. | ||
* @param {Function} [customizer] The function to customize comparing values. | ||
* @param {Function} [customizer] The function to customize value comparisons. | ||
* @param {*} [thisArg] The `this` binding of `customizer`. | ||
@@ -55,5 +55,5 @@ * @returns {boolean} Returns `true` if the values are equivalent, else `false`. | ||
var result = customizer ? customizer(value, other) : undefined; | ||
return typeof result == 'undefined' ? baseIsEqual(value, other, customizer) : !!result; | ||
return result === undefined ? baseIsEqual(value, other, customizer) : !!result; | ||
} | ||
export default isEqual; |
@@ -24,3 +24,3 @@ import baseIsMatch from '../internal/baseIsMatch'; | ||
* @param {Object} source The object of property values to match. | ||
* @param {Function} [customizer] The function to customize comparing values. | ||
* @param {Function} [customizer] The function to customize value comparisons. | ||
* @param {*} [thisArg] The `this` binding of `customizer`. | ||
@@ -58,2 +58,3 @@ * @returns {boolean} Returns `true` if `object` is a match, else `false`. | ||
customizer = typeof customizer == 'function' && bindCallback(customizer, thisArg, 3); | ||
object = toObject(object); | ||
if (!customizer && length == 1) { | ||
@@ -64,3 +65,3 @@ var key = props[0], | ||
if (isStrictComparable(value)) { | ||
return value === object[key] && (typeof value != 'undefined' || (key in toObject(object))); | ||
return value === object[key] && (value !== undefined || (key in object)); | ||
} | ||
@@ -75,5 +76,5 @@ } | ||
} | ||
return baseIsMatch(toObject(object), props, values, strictCompareFlags, customizer); | ||
return baseIsMatch(object, props, values, strictCompareFlags, customizer); | ||
} | ||
export default isMatch; |
@@ -8,3 +8,3 @@ import escapeRegExp from '../string/escapeRegExp'; | ||
/** Used to detect host constructors (Safari > 5). */ | ||
var reHostCtor = /^\[object .+?Constructor\]$/; | ||
var reIsHostCtor = /^\[object .+?Constructor\]$/; | ||
@@ -24,3 +24,3 @@ /** Used for native method references. */ | ||
/** Used to detect if a method is native. */ | ||
var reNative = RegExp('^' + | ||
var reIsNative = RegExp('^' + | ||
escapeRegExp(objToString) | ||
@@ -51,7 +51,7 @@ .replace(/toString|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' | ||
if (objToString.call(value) == funcTag) { | ||
return reNative.test(fnToString.call(value)); | ||
return reIsNative.test(fnToString.call(value)); | ||
} | ||
return isObjectLike(value) && reHostCtor.test(value); | ||
return isObjectLike(value) && reIsHostCtor.test(value); | ||
} | ||
export default isNative; |
@@ -18,5 +18,5 @@ /** | ||
function isUndefined(value) { | ||
return typeof value == 'undefined'; | ||
return value === undefined; | ||
} | ||
export default isUndefined; |
import arrayCopy from '../internal/arrayCopy'; | ||
import getLength from '../internal/getLength'; | ||
import isLength from '../internal/isLength'; | ||
@@ -21,3 +22,3 @@ import values from '../object/values'; | ||
function toArray(value) { | ||
var length = value ? value.length : 0; | ||
var length = value ? getLength(value) : 0; | ||
if (!isLength(length)) { | ||
@@ -24,0 +25,0 @@ return values(value); |
/** | ||
* @license | ||
* lodash 3.6.0 (Custom Build) <https://lodash.com/> | ||
* lodash 3.7.0 (Custom Build) <https://lodash.com/> | ||
* Build: `lodash modularize modern exports="es" -o ./` | ||
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/> | ||
* Based on Underscore.js 1.8.2 <http://underscorejs.org/LICENSE> | ||
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> | ||
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors | ||
@@ -28,3 +28,2 @@ * Available under MIT license <https://lodash.com/license> | ||
import baseMatches from './internal/baseMatches'; | ||
import baseProperty from './internal/baseProperty'; | ||
import createHybridWrapper from './internal/createHybridWrapper'; | ||
@@ -41,2 +40,3 @@ import identity from './utility/identity'; | ||
import _mixin from './utility/mixin'; | ||
import property from './utility/property'; | ||
import realNames from './internal/realNames'; | ||
@@ -47,3 +47,3 @@ import support from './support'; | ||
/** Used as the semantic version number. */ | ||
var VERSION = '3.6.0'; | ||
var VERSION = '3.7.0'; | ||
@@ -141,2 +141,4 @@ /** Used to compose bitmasks for wrapper metadata. */ | ||
lodash.merge = object.merge; | ||
lodash.method = utility.method; | ||
lodash.methodOf = utility.methodOf; | ||
lodash.mixin = mixin; | ||
@@ -152,3 +154,3 @@ lodash.negate = func.negate; | ||
lodash.pluck = collection.pluck; | ||
lodash.property = utility.property; | ||
lodash.property = property; | ||
lodash.propertyOf = utility.propertyOf; | ||
@@ -163,2 +165,3 @@ lodash.pull = array.pull; | ||
lodash.restParam = func.restParam; | ||
lodash.set = object.set; | ||
lodash.shuffle = collection.shuffle; | ||
@@ -230,2 +233,3 @@ lodash.slice = array.slice; | ||
lodash.first = array.first; | ||
lodash.get = object.get; | ||
lodash.has = object.has; | ||
@@ -416,3 +420,3 @@ lodash.identity = identity; | ||
var operationName = index ? 'filter' : 'map', | ||
createCallback = index ? baseMatches : baseProperty; | ||
createCallback = index ? baseMatches : property; | ||
@@ -439,3 +443,3 @@ LazyWrapper.prototype[methodName] = function(value) { | ||
if (typeof end != 'undefined') { | ||
if (end !== undefined) { | ||
end = (+end || 0); | ||
@@ -471,3 +475,3 @@ result = end < 0 ? result.dropRight(-end) : result.take(end - start); | ||
if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) { | ||
// avoid lazy use if the iteratee has a `length` other than `1` | ||
// avoid lazy use if the iteratee has a "length" value other than `1` | ||
isLazy = useLazy = false; | ||
@@ -474,0 +478,0 @@ } |
@@ -16,5 +16,5 @@ /** | ||
function add(augend, addend) { | ||
return augend + addend; | ||
return (+augend || 0) + (+addend || 0); | ||
} | ||
export default add; |
@@ -0,1 +1,5 @@ | ||
/* Native method references for those with the same name as other `lodash` methods. */ | ||
var nativeMax = Math.max, | ||
nativeMin = Math.min; | ||
/** | ||
@@ -40,5 +44,5 @@ * Checks if `n` is between `start` and up to but not including, `end`. If | ||
} | ||
return value >= start && value < end; | ||
return value >= nativeMin(start, end) && value < nativeMax(start, end); | ||
} | ||
export default inRange; |
@@ -12,2 +12,3 @@ import assign from './object/assign'; | ||
import functions from './object/functions'; | ||
import get from './object/get'; | ||
import has from './object/has'; | ||
@@ -24,2 +25,3 @@ import invert from './object/invert'; | ||
import result from './object/result'; | ||
import set from './object/set'; | ||
import transform from './object/transform'; | ||
@@ -41,2 +43,3 @@ import values from './object/values'; | ||
'functions': functions, | ||
'get': get, | ||
'has': has, | ||
@@ -53,2 +56,3 @@ 'invert': invert, | ||
'result': result, | ||
'set': set, | ||
'transform': transform, | ||
@@ -55,0 +59,0 @@ 'values': values, |
@@ -0,1 +1,2 @@ | ||
import assignWith from '../internal/assignWith'; | ||
import baseAssign from '../internal/baseAssign'; | ||
@@ -11,2 +12,6 @@ import createAssigner from '../internal/createAssigner'; | ||
* | ||
* **Note:** This method mutates `object` and is based on | ||
* [`Object.assign`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign). | ||
* | ||
* | ||
* @static | ||
@@ -18,3 +23,3 @@ * @memberOf _ | ||
* @param {...Object} [sources] The source objects. | ||
* @param {Function} [customizer] The function to customize assigning values. | ||
* @param {Function} [customizer] The function to customize assigned values. | ||
* @param {*} [thisArg] The `this` binding of `customizer`. | ||
@@ -29,3 +34,3 @@ * @returns {Object} Returns `object`. | ||
* var defaults = _.partialRight(_.assign, function(value, other) { | ||
* return typeof value == 'undefined' ? other : value; | ||
* return _.isUndefined(value) ? other : value; | ||
* }); | ||
@@ -36,4 +41,8 @@ * | ||
*/ | ||
var assign = createAssigner(baseAssign); | ||
var assign = createAssigner(function(object, source, customizer) { | ||
return customizer | ||
? assignWith(object, source, customizer) | ||
: baseAssign(object, source); | ||
}); | ||
export default assign; |
@@ -1,5 +0,4 @@ | ||
import baseCopy from '../internal/baseCopy'; | ||
import baseAssign from '../internal/baseAssign'; | ||
import baseCreate from '../internal/baseCreate'; | ||
import isIterateeCall from '../internal/isIterateeCall'; | ||
import keys from './keys'; | ||
@@ -45,5 +44,5 @@ /** | ||
} | ||
return properties ? baseCopy(properties, result, keys(properties)) : result; | ||
return properties ? baseAssign(result, properties) : result; | ||
} | ||
export default create; |
@@ -10,2 +10,4 @@ import assign from './assign'; | ||
* | ||
* **Note:** This method mutates `object`. | ||
* | ||
* @static | ||
@@ -12,0 +14,0 @@ * @memberOf _ |
@@ -7,3 +7,3 @@ import baseFor from '../internal/baseFor'; | ||
* `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). Iteratee functions may exit | ||
* iteration early by explicitly returning `false`. | ||
@@ -10,0 +10,0 @@ * |
@@ -7,3 +7,3 @@ import baseForOwn from '../internal/baseForOwn'; | ||
* 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). Iteratee functions may exit iteration | ||
* early by explicitly returning `false`. | ||
@@ -10,0 +10,0 @@ * |
@@ -0,1 +1,7 @@ | ||
import baseGet from '../internal/baseGet'; | ||
import baseSlice from '../internal/baseSlice'; | ||
import isKey from '../internal/isKey'; | ||
import last from '../array/last'; | ||
import toPath from '../internal/toPath'; | ||
/** Used for native method references. */ | ||
@@ -8,4 +14,3 @@ var objectProto = Object.prototype; | ||
/** | ||
* Checks if `key` exists as a direct property of `object` instead of an | ||
* inherited property. | ||
* Checks if `path` is a direct property. | ||
* | ||
@@ -15,16 +20,32 @@ * @static | ||
* @category Object | ||
* @param {Object} object The object to inspect. | ||
* @param {string} key The key to check. | ||
* @returns {boolean} Returns `true` if `key` is a direct property, else `false`. | ||
* @param {Object} object The object to query. | ||
* @param {Array|string} path The path to check. | ||
* @returns {boolean} Returns `true` if `path` is a direct property, else `false`. | ||
* @example | ||
* | ||
* var object = { 'a': 1, 'b': 2, 'c': 3 }; | ||
* var object = { 'a': { 'b': { 'c': 3 } } }; | ||
* | ||
* _.has(object, 'b'); | ||
* _.has(object, 'a'); | ||
* // => true | ||
* | ||
* _.has(object, 'a.b.c'); | ||
* // => true | ||
* | ||
* _.has(object, ['a', 'b', 'c']); | ||
* // => true | ||
*/ | ||
function has(object, key) { | ||
return object ? hasOwnProperty.call(object, key) : false; | ||
function has(object, path) { | ||
if (object == null) { | ||
return false; | ||
} | ||
var result = hasOwnProperty.call(object, path); | ||
if (!result && !isKey(path)) { | ||
path = toPath(path); | ||
object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1)); | ||
path = last(path); | ||
result = object != null && hasOwnProperty.call(object, path); | ||
} | ||
return result; | ||
} | ||
export default has; |
@@ -19,3 +19,3 @@ import isLength from '../internal/isLength'; | ||
* @category Object | ||
* @param {Object} object The object to inspect. | ||
* @param {Object} object The object to query. | ||
* @returns {Array} Returns the array of property names. | ||
@@ -43,3 +43,3 @@ * @example | ||
if ((typeof Ctor == 'function' && Ctor.prototype === object) || | ||
(typeof object != 'function' && (length && isLength(length)))) { | ||
(typeof object != 'function' && isLength(length))) { | ||
return shimKeys(object); | ||
@@ -46,0 +46,0 @@ } |
@@ -22,3 +22,3 @@ import isArguments from '../lang/isArguments'; | ||
* @category Object | ||
* @param {Object} object The object to inspect. | ||
* @param {Object} object The object to query. | ||
* @returns {Array} Returns the array of property names. | ||
@@ -25,0 +25,0 @@ * @example |
@@ -18,3 +18,3 @@ import baseMerge from '../internal/baseMerge'; | ||
* @param {...Object} [sources] The source objects. | ||
* @param {Function} [customizer] The function to customize merging properties. | ||
* @param {Function} [customizer] The function to customize assigned values. | ||
* @param {*} [thisArg] The `this` binding of `customizer`. | ||
@@ -21,0 +21,0 @@ * @returns {Object} Returns `object`. |
@@ -10,3 +10,3 @@ import keys from './keys'; | ||
* @category Object | ||
* @param {Object} object The object to inspect. | ||
* @param {Object} object The object to query. | ||
* @returns {Array} Returns the new array of key-value pairs. | ||
@@ -13,0 +13,0 @@ * @example |
@@ -0,8 +1,12 @@ | ||
import baseGet from '../internal/baseGet'; | ||
import baseSlice from '../internal/baseSlice'; | ||
import isFunction from '../lang/isFunction'; | ||
import isKey from '../internal/isKey'; | ||
import last from '../array/last'; | ||
import toPath from '../internal/toPath'; | ||
/** | ||
* Resolves the value of property `key` on `object`. If the value of `key` is | ||
* a function it is invoked with the `this` binding of `object` and its result | ||
* is returned, else the property value is returned. If the property value is | ||
* `undefined` the `defaultValue` is used in its place. | ||
* This method is like `_.get` except that if the resolved value is a function | ||
* it is invoked with the `this` binding of its parent object and its result | ||
* is returned. | ||
* | ||
@@ -13,30 +17,34 @@ * @static | ||
* @param {Object} object The object to query. | ||
* @param {string} key The key of the property to resolve. | ||
* @param {*} [defaultValue] The value returned if the property value | ||
* resolves to `undefined`. | ||
* @param {Array|string} path The path of the property to resolve. | ||
* @param {*} [defaultValue] The value returned if the resolved value is `undefined`. | ||
* @returns {*} Returns the resolved value. | ||
* @example | ||
* | ||
* var object = { 'user': 'fred', 'age': _.constant(40) }; | ||
* var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] }; | ||
* | ||
* _.result(object, 'user'); | ||
* // => 'fred' | ||
* _.result(object, 'a[0].b.c1'); | ||
* // => 3 | ||
* | ||
* _.result(object, 'age'); | ||
* // => 40 | ||
* _.result(object, 'a[0].b.c2'); | ||
* // => 4 | ||
* | ||
* _.result(object, 'status', 'busy'); | ||
* // => 'busy' | ||
* _.result(object, 'a.b.c', 'default'); | ||
* // => 'default' | ||
* | ||
* _.result(object, 'status', _.constant('busy')); | ||
* // => 'busy' | ||
* _.result(object, 'a.b.c', _.constant('default')); | ||
* // => 'default' | ||
*/ | ||
function result(object, key, defaultValue) { | ||
var value = object == null ? undefined : object[key]; | ||
if (typeof value == 'undefined') { | ||
value = defaultValue; | ||
function result(object, path, defaultValue) { | ||
var result = object == null ? undefined : object[path]; | ||
if (result === undefined) { | ||
if (object != null && !isKey(path, object)) { | ||
path = toPath(path); | ||
object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1)); | ||
result = object == null ? undefined : object[last(path)]; | ||
} | ||
result = result === undefined ? defaultValue : result; | ||
} | ||
return isFunction(value) ? value.call(object) : value; | ||
return isFunction(result) ? result.call(object) : result; | ||
} | ||
export default result; |
@@ -15,3 +15,3 @@ import arrayEach from '../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). Iteratee functions | ||
* may exit iteration early by explicitly returning `false`. | ||
@@ -18,0 +18,0 @@ * |
{ | ||
"name": "lodash-es", | ||
"version": "3.6.0", | ||
"version": "3.7.0", | ||
"description": "The modern build of lodash exported as ES modules.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://lodash.com/custom-builds", |
@@ -1,2 +0,2 @@ | ||
# lodash-es v3.6.0 | ||
# lodash-es v3.7.0 | ||
@@ -10,2 +10,2 @@ The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash](https://lodash.com/) exported as [ES](https://people.mozilla.org/~jorendorff/es6-draft.html) modules. | ||
See the [package source](https://github.com/lodash/lodash/tree/3.6.0-es) for more details. | ||
See the [package source](https://github.com/lodash/lodash/tree/3.7.0-es) for more details. |
import baseToString from '../internal/baseToString'; | ||
import deburrLetter from '../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 [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks). */ | ||
var reComboMark = /[\u0300-\u036f\ufe20-\ufe23]/g; | ||
@@ -28,5 +26,5 @@ /** Used to match latin-1 supplementary letters (excluding mathematical operators). */ | ||
string = baseToString(string); | ||
return string && string.replace(reLatin1, deburrLetter).replace(reComboMarks, ''); | ||
return string && string.replace(reLatin1, deburrLetter).replace(reComboMark, ''); | ||
} | ||
export default deburr; |
@@ -32,3 +32,3 @@ import baseToString from '../internal/baseToString'; | ||
var length = string.length; | ||
position = typeof position == 'undefined' | ||
position = position === undefined | ||
? length | ||
@@ -35,0 +35,0 @@ : nativeMin(position < 0 ? 0 : (+position || 0), length); |
@@ -22,5 +22,6 @@ import baseToString from '../internal/baseToString'; | ||
* Backticks are escaped because in Internet Explorer < 9, they can break out | ||
* of attribute values or HTML comments. See [#102](https://html5sec.org/#102), | ||
* [#108](https://html5sec.org/#108), and [#133](https://html5sec.org/#133) of | ||
* the [HTML5 Security Cheatsheet](https://html5sec.org/) for more details. | ||
* of attribute values or HTML comments. See [#59](https://html5sec.org/#59), | ||
* [#102](https://html5sec.org/#102), [#108](https://html5sec.org/#108), and | ||
* [#133](https://html5sec.org/#133) of the [HTML5 Security Cheatsheet](https://html5sec.org/) | ||
* for more details. | ||
* | ||
@@ -27,0 +28,0 @@ * When working with HTML you should always [quote attribute values](http://wonko.com/post/html-escaping) |
@@ -6,3 +6,3 @@ import isIterateeCall from '../internal/isIterateeCall'; | ||
/** Used to detect hexadecimal string values. */ | ||
var reHexPrefix = /^0[xX]/; | ||
var reHasHexPrefix = /^0[xX]/; | ||
@@ -65,3 +65,3 @@ /** Used to detect and test for whitespace. */ | ||
string = trim(string); | ||
return nativeParseInt(string, radix || (reHexPrefix.test(string) ? 16 : 10)); | ||
return nativeParseInt(string, radix || (reHasHexPrefix.test(string) ? 16 : 10)); | ||
}; | ||
@@ -68,0 +68,0 @@ } |
import assignOwnDefaults from '../internal/assignOwnDefaults'; | ||
import assignWith from '../internal/assignWith'; | ||
import attempt from '../utility/attempt'; | ||
@@ -18,5 +19,3 @@ import baseAssign from '../internal/baseAssign'; | ||
/** | ||
* Used to match [ES template delimiters](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-template-literal-lexical-components). | ||
*/ | ||
/** Used to match [ES template delimiters](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-template-literal-lexical-components). */ | ||
var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g; | ||
@@ -135,5 +134,5 @@ | ||
string = baseToString(string); | ||
options = baseAssign(baseAssign({}, otherOptions || options), settings, assignOwnDefaults); | ||
options = assignWith(baseAssign({}, otherOptions || options), settings, assignOwnDefaults); | ||
var imports = baseAssign(baseAssign({}, options.imports), settings.imports, assignOwnDefaults), | ||
var imports = assignWith(baseAssign({}, options.imports), settings.imports, assignOwnDefaults), | ||
importsKeys = keys(imports), | ||
@@ -140,0 +139,0 @@ importsValues = baseValues(imports, importsKeys); |
@@ -22,3 +22,9 @@ import root from './internal/root'; | ||
(function(x) { | ||
var Ctor = function() { this.x = x; }, | ||
object = { '0': x, 'length': x }, | ||
props = []; | ||
Ctor.prototype = { 'valueOf': x, 'y': x }; | ||
for (var key in new Ctor) { props.push(key); } | ||
/** | ||
@@ -60,4 +66,4 @@ * Detect if functions can be decompiled by `Function#toString` | ||
* `arguments` object indexes as non-enumerable and fail `hasOwnProperty` | ||
* checks for indexes that exceed their function's formal parameters with | ||
* associated values of `0`. | ||
* checks for indexes that exceed the number of function parameters and | ||
* whose associated argument values are `0`. | ||
* | ||
@@ -72,4 +78,4 @@ * @memberOf _.support | ||
} | ||
}(0, 0)); | ||
}(1, 0)); | ||
export default support; |
@@ -8,2 +8,4 @@ import attempt from './utility/attempt'; | ||
import matchesProperty from './utility/matchesProperty'; | ||
import method from './utility/method'; | ||
import methodOf from './utility/methodOf'; | ||
import mixin from './utility/mixin'; | ||
@@ -25,2 +27,4 @@ import noop from './utility/noop'; | ||
'matchesProperty': matchesProperty, | ||
'method': method, | ||
'methodOf': methodOf, | ||
'mixin': mixin, | ||
@@ -27,0 +31,0 @@ 'noop': noop, |
import baseCallback from '../internal/baseCallback'; | ||
import isIterateeCall from '../internal/isIterateeCall'; | ||
import isObjectLike from '../internal/isObjectLike'; | ||
import matches from './matches'; | ||
@@ -48,7 +46,5 @@ /** | ||
} | ||
return isObjectLike(func) | ||
? matches(func) | ||
: baseCallback(func, thisArg); | ||
return baseCallback(func, thisArg); | ||
} | ||
export default callback; |
@@ -5,3 +5,3 @@ import baseClone from '../internal/baseClone'; | ||
/** | ||
* Creates a function which compares the property value of `key` on a given | ||
* Creates a function which compares the property value of `path` on a given | ||
* object to `value`. | ||
@@ -16,3 +16,3 @@ * | ||
* @category Utility | ||
* @param {string} key The key of the property to get. | ||
* @param {Array|string} path The path of the property to get. | ||
* @param {*} value The value to compare. | ||
@@ -30,6 +30,6 @@ * @returns {Function} Returns the new function. | ||
*/ | ||
function matchesProperty(key, value) { | ||
return baseMatchesProperty(key + '', baseClone(value, true)); | ||
function matchesProperty(path, value) { | ||
return baseMatchesProperty(path, baseClone(value, true)); | ||
} | ||
export default matchesProperty; |
@@ -18,4 +18,4 @@ import arrayCopy from '../internal/arrayCopy'; | ||
* | ||
* **Note:** Use `_.runInContext` to create a pristine `lodash` function | ||
* for mixins to avoid conflicts caused by modifying the original. | ||
* **Note:** Use `_.runInContext` to create a pristine `lodash` function to | ||
* avoid conflicts caused by modifying the original. | ||
* | ||
@@ -25,3 +25,3 @@ * @static | ||
* @category Utility | ||
* @param {Function|Object} [object=this] object The destination object. | ||
* @param {Function|Object} [object=lodash] The destination object. | ||
* @param {Object} source The object of functions to add. | ||
@@ -28,0 +28,0 @@ * @param {Object} [options] The options object. |
import baseProperty from '../internal/baseProperty'; | ||
import basePropertyDeep from '../internal/basePropertyDeep'; | ||
import isKey from '../internal/isKey'; | ||
/** | ||
* Creates a function which returns the property value of `key` on a given object. | ||
* Creates a function which returns the property value at `path` on a | ||
* given object. | ||
* | ||
@@ -9,23 +12,21 @@ * @static | ||
* @category Utility | ||
* @param {string} key The key of the property to get. | ||
* @param {Array|string} path The path of the property to get. | ||
* @returns {Function} Returns the new function. | ||
* @example | ||
* | ||
* var users = [ | ||
* { 'user': 'fred' }, | ||
* { 'user': 'barney' } | ||
* var objects = [ | ||
* { 'a': { 'b': { 'c': 2 } } }, | ||
* { 'a': { 'b': { 'c': 1 } } } | ||
* ]; | ||
* | ||
* var getName = _.property('user'); | ||
* _.map(objects, _.property('a.b.c')); | ||
* // => [2, 1] | ||
* | ||
* _.map(users, getName); | ||
* // => ['fred', 'barney'] | ||
* | ||
* _.pluck(_.sortBy(users, getName), 'user'); | ||
* // => ['barney', 'fred'] | ||
* _.pluck(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); | ||
* // => [1, 2] | ||
*/ | ||
function property(key) { | ||
return baseProperty(key + ''); | ||
function property(path) { | ||
return isKey(path) ? baseProperty(path) : basePropertyDeep(path); | ||
} | ||
export default property; |
@@ -0,4 +1,7 @@ | ||
import baseGet from '../internal/baseGet'; | ||
import toPath from '../internal/toPath'; | ||
/** | ||
* The opposite of `_.property`; this method creates a function which returns | ||
* the property value of a given key on `object`. | ||
* the property value at a given path on `object`. | ||
* | ||
@@ -8,17 +11,18 @@ * @static | ||
* @category Utility | ||
* @param {Object} object The object to inspect. | ||
* @param {Object} object The object to query. | ||
* @returns {Function} Returns the new function. | ||
* @example | ||
* | ||
* var object = { 'a': 3, 'b': 1, 'c': 2 }; | ||
* var array = [0, 1, 2], | ||
* object = { 'a': array, 'b': array, 'c': array }; | ||
* | ||
* _.map(['a', 'c'], _.propertyOf(object)); | ||
* // => [3, 2] | ||
* _.map(['a[2]', 'c[0]'], _.propertyOf(object)); | ||
* // => [2, 0] | ||
* | ||
* _.sortBy(['a', 'b', 'c'], _.propertyOf(object)); | ||
* // => ['b', 'c', 'a'] | ||
* _.map([['a', '2'], ['c', '0']], _.propertyOf(object)); | ||
* // => [2, 0] | ||
*/ | ||
function propertyOf(object) { | ||
return function(key) { | ||
return object == null ? undefined : object[key]; | ||
return function(path) { | ||
return baseGet(object, toPath(path), path + ''); | ||
}; | ||
@@ -25,0 +29,0 @@ } |
@@ -12,3 +12,3 @@ import isIterateeCall from '../internal/isIterateeCall'; | ||
* `start` up to, but not including, `end`. If `end` is not specified it is | ||
* set to `start` with `start` then set to `0`. If `start` is less than `end` | ||
* set to `start` with `start` then set to `0`. If `end` is less than `start` | ||
* a zero-length range is created unless a negative `step` is specified. | ||
@@ -15,0 +15,0 @@ * |
import bindCallback from '../internal/bindCallback'; | ||
import root from '../internal/root'; | ||
/** Native method references. */ | ||
var floor = Math.floor; | ||
/* Native method references for those with the same name as other `lodash` methods. */ | ||
@@ -31,3 +34,3 @@ var nativeIsFinite = root.isFinite, | ||
* }); | ||
* // => invokes `mage.castSpell(n)` three times with `n` of `0`, `1`, and `2` respectively | ||
* // => invokes `mage.castSpell(n)` three times with `n` of `0`, `1`, and `2` | ||
* | ||
@@ -40,3 +43,3 @@ * _.times(3, function(n) { | ||
function times(n, iteratee, thisArg) { | ||
n = +n; | ||
n = floor(n); | ||
@@ -43,0 +46,0 @@ // Exit early to avoid a JSC JIT bug in Safari 8 |
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
437023
401
13323