Comparing version 3.8.0 to 3.9.0
var baseIndexOf = require('../internal/baseIndexOf'), | ||
cacheIndexOf = require('../internal/cacheIndexOf'), | ||
createCache = require('../internal/createCache'), | ||
isArrayLike = require('../internal/isArrayLike'); | ||
isArrayLike = require('../internal/isArrayLike'), | ||
restParam = require('../function/restParam'); | ||
@@ -20,7 +21,6 @@ /** | ||
*/ | ||
function intersection() { | ||
var args = [], | ||
argsIndex = -1, | ||
argsLength = arguments.length, | ||
caches = [], | ||
var intersection = restParam(function(arrays) { | ||
var othLength = arrays.length, | ||
othIndex = othLength, | ||
caches = Array(length), | ||
indexOf = baseIndexOf, | ||
@@ -30,14 +30,7 @@ isCommon = true, | ||
while (++argsIndex < argsLength) { | ||
var value = arguments[argsIndex]; | ||
if (isArrayLike(value)) { | ||
args.push(value); | ||
caches.push((isCommon && value.length >= 120) ? createCache(argsIndex && value) : null); | ||
} | ||
while (othIndex--) { | ||
var value = arrays[othIndex] = isArrayLike(value = arrays[othIndex]) ? value : []; | ||
caches[othIndex] = (isCommon && value.length >= 120) ? createCache(othIndex && value) : null; | ||
} | ||
argsLength = args.length; | ||
if (argsLength < 2) { | ||
return result; | ||
} | ||
var array = args[0], | ||
var array = arrays[0], | ||
index = -1, | ||
@@ -51,6 +44,6 @@ length = array ? array.length : 0, | ||
if ((seen ? cacheIndexOf(seen, value) : indexOf(result, value, 0)) < 0) { | ||
argsIndex = argsLength; | ||
while (--argsIndex) { | ||
var cache = caches[argsIndex]; | ||
if ((cache ? cacheIndexOf(cache, value) : indexOf(args[argsIndex], value, 0)) < 0) { | ||
var othIndex = othLength; | ||
while (--othIndex) { | ||
var cache = caches[othIndex]; | ||
if ((cache ? cacheIndexOf(cache, value) : indexOf(arrays[othIndex], value, 0)) < 0) { | ||
continue outer; | ||
@@ -66,4 +59,4 @@ } | ||
return result; | ||
} | ||
}); | ||
module.exports = intersection; |
@@ -23,4 +23,4 @@ var restParam = require('../function/restParam'), | ||
var length = arrays.length, | ||
iteratee = arrays[length - 2], | ||
thisArg = arrays[length - 1]; | ||
iteratee = length > 2 ? arrays[length - 2] : undefined, | ||
thisArg = length > 1 ? arrays[length - 1] : undefined; | ||
@@ -27,0 +27,0 @@ if (length > 2 && typeof iteratee == 'function') { |
@@ -53,11 +53,12 @@ var LazyWrapper = require('../internal/LazyWrapper'), | ||
* `groupBy`, `indexBy`, `initial`, `intersection`, `invert`, `invoke`, `keys`, | ||
* `keysIn`, `map`, `mapValues`, `matches`, `matchesProperty`, `memoize`, | ||
* `merge`, `mixin`, `negate`, `omit`, `once`, `pairs`, `partial`, `partialRight`, | ||
* `partition`, `pick`, `plant`, `pluck`, `property`, `propertyOf`, `pull`, | ||
* `pullAt`, `push`, `range`, `rearg`, `reject`, `remove`, `rest`, `reverse`, | ||
* `shuffle`, `slice`, `sort`, `sortBy`, `sortByAll`, `sortByOrder`, `splice`, | ||
* `spread`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, `tap`, | ||
* `throttle`, `thru`, `times`, `toArray`, `toPlainObject`, `transform`, | ||
* `union`, `uniq`, `unshift`, `unzip`, `values`, `valuesIn`, `where`, | ||
* `without`, `wrap`, `xor`, `zip`, and `zipObject` | ||
* `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`, | ||
* `memoize`, `merge`, `method`, `methodOf`, `mixin`, `negate`, `omit`, `once`, | ||
* `pairs`, `partial`, `partialRight`, `partition`, `pick`, `plant`, `pluck`, | ||
* `property`, `propertyOf`, `pull`, `pullAt`, `push`, `range`, `rearg`, | ||
* `reject`, `remove`, `rest`, `restParam`, `reverse`, `set`, `shuffle`, | ||
* `slice`, `sort`, `sortBy`, `sortByAll`, `sortByOrder`, `splice`, `spread`, | ||
* `take`, `takeRight`, `takeRightWhile`, `takeWhile`, `tap`, `throttle`, | ||
* `thru`, `times`, `toArray`, `toPlainObject`, `transform`, `union`, `uniq`, | ||
* `unshift`, `unzip`, `unzipWith`, `values`, `valuesIn`, `where`, `without`, | ||
* `wrap`, `xor`, `zip`, `zipObject`, `zipWith` | ||
* | ||
@@ -67,13 +68,13 @@ * The wrapper methods that are **not** chainable by default are: | ||
* `endsWith`, `escape`, `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, | ||
* `findLast`, `findLastIndex`, `findLastKey`, `findWhere`, `first`, `has`, | ||
* `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`, | ||
* `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` | ||
* `findLast`, `findLastIndex`, `findLastKey`, `findWhere`, `first`, `get`, | ||
* `gt`, `gte`, `has`, `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`, `lt`, `lte`, | ||
* `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` | ||
* | ||
@@ -80,0 +81,0 @@ * The wrapper method `sample` will return a wrapped value when `n` is provided, |
@@ -8,3 +8,3 @@ var baseEach = require('../internal/baseEach'), | ||
/** | ||
* Invokes the method at `path` on each element in `collection`, returning | ||
* Invokes the method at `path` of each element in `collection`, returning | ||
* an array of the results of each invoked method. Any additional arguments | ||
@@ -37,3 +37,3 @@ * are provided to each invoked method. If `methodName` is a function it is | ||
baseEach(collection, function(value) { | ||
var func = isFunc ? path : (isProp && value != null && value[path]); | ||
var func = isFunc ? path : ((isProp && value != null) ? value[path] : null); | ||
result[++index] = func ? func.apply(value, args) : invokePath(value, path, args); | ||
@@ -40,0 +40,0 @@ }); |
@@ -22,3 +22,3 @@ var arrayMap = require('../internal/arrayMap'), | ||
* | ||
* Many lodash methods are guarded to work as interatees for methods like | ||
* Many lodash methods are guarded to work as iteratees for methods like | ||
* `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`. | ||
@@ -25,0 +25,0 @@ * |
@@ -13,3 +13,3 @@ var arrayReduce = require('../internal/arrayReduce'), | ||
* | ||
* Many lodash methods are guarded to work as interatees for methods like | ||
* Many lodash methods are guarded to work as iteratees for methods like | ||
* `_.reduce`, `_.reduceRight`, and `_.transform`. | ||
@@ -16,0 +16,0 @@ * |
@@ -1,5 +0,5 @@ | ||
var isNative = require('../lang/isNative'); | ||
var getNative = require('../internal/getNative'); | ||
/* Native method references for those with the same name as other `lodash` methods. */ | ||
var nativeNow = isNative(nativeNow = Date.now) && nativeNow; | ||
var nativeNow = getNative(Date, 'now'); | ||
@@ -6,0 +6,0 @@ /** |
@@ -11,8 +11,9 @@ var isObject = require('../lang/isObject'), | ||
/** | ||
* Creates a function that delays invoking `func` until after `wait` milliseconds | ||
* have elapsed since the last time it was invoked. The created function comes | ||
* with a `cancel` method to cancel delayed invocations. Provide an options | ||
* object to indicate that `func` should be invoked on the leading and/or | ||
* trailing edge of the `wait` timeout. Subsequent calls to the debounced | ||
* function return the result of the last `func` invocation. | ||
* Creates a debounced function that delays invoking `func` until after `wait` | ||
* milliseconds have elapsed since the last time the debounced function was | ||
* invoked. The debounced function comes with a `cancel` method to cancel | ||
* delayed invocations. Provide an options object to indicate that `func` | ||
* should be invoked on the leading and/or trailing edge of the `wait` timeout. | ||
* Subsequent calls to the debounced function return the result of the last | ||
* `func` invocation. | ||
* | ||
@@ -19,0 +20,0 @@ * **Note:** If `leading` and `trailing` options are `true`, `func` is invoked |
@@ -63,4 +63,4 @@ var MapCache = require('../internal/MapCache'); | ||
var args = arguments, | ||
cache = memoized.cache, | ||
key = resolver ? resolver.apply(this, args) : args[0]; | ||
key = resolver ? resolver.apply(this, args) : args[0], | ||
cache = memoized.cache; | ||
@@ -71,3 +71,3 @@ if (cache.has(key)) { | ||
var result = func.apply(this, args); | ||
cache.set(key, result); | ||
memoized.cache = cache.set(key, result); | ||
return result; | ||
@@ -74,0 +74,0 @@ }; |
@@ -15,8 +15,8 @@ var debounce = require('./debounce'), | ||
/** | ||
* Creates a function that only invokes `func` at most once per every `wait` | ||
* milliseconds. The created function comes with a `cancel` method to cancel | ||
* delayed invocations. Provide an options object to indicate that `func` | ||
* should be invoked on the leading and/or trailing edge of the `wait` timeout. | ||
* Subsequent calls to the throttled function return the result of the last | ||
* `func` call. | ||
* Creates a throttled function that only invokes `func` at most once per | ||
* every `wait` milliseconds. The throttled function comes with a `cancel` | ||
* method to cancel delayed invocations. Provide an options object to indicate | ||
* that `func` should be invoked on the leading and/or trailing edge of the | ||
* `wait` timeout. Subsequent calls to the throttled function return the | ||
* result of the last `func` call. | ||
* | ||
@@ -23,0 +23,0 @@ * **Note:** If `leading` and `trailing` options are `true`, `func` is invoked |
@@ -1,10 +0,3 @@ | ||
var getSymbols = require('./getSymbols'), | ||
keys = require('../object/keys'); | ||
var keys = require('../object/keys'); | ||
/** Used for native method references. */ | ||
var arrayProto = Array.prototype; | ||
/** Native method references. */ | ||
var push = arrayProto.push; | ||
/** | ||
@@ -22,6 +15,4 @@ * A specialized version of `_.assign` for customizing assigned values without | ||
function assignWith(object, source, customizer) { | ||
var props = keys(source); | ||
push.apply(props, getSymbols(source)); | ||
var index = -1, | ||
props = keys(source), | ||
length = props.length; | ||
@@ -28,0 +19,0 @@ |
var baseCopy = require('./baseCopy'), | ||
getSymbols = require('./getSymbols'), | ||
isNative = require('../lang/isNative'), | ||
keys = require('../object/keys'); | ||
/** Native method references. */ | ||
var preventExtensions = isNative(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. | ||
var func = preventExtensions && isNative(func = Object.assign) && func; | ||
try { | ||
if (func) { | ||
var object = preventExtensions({ '1': 0 }); | ||
object[0] = 1; | ||
} | ||
} catch(e) { | ||
// Only attempt in strict mode. | ||
try { func(object, 'xo'); } catch(e) {} | ||
return !object[1] && func; | ||
} | ||
return false; | ||
}()); | ||
/** | ||
@@ -41,8 +13,8 @@ * The base implementation of `_.assign` without support for argument juggling, | ||
*/ | ||
var baseAssign = nativeAssign || function(object, source) { | ||
function baseAssign(object, source) { | ||
return source == null | ||
? object | ||
: baseCopy(source, getSymbols(source), baseCopy(source, keys(source), object)); | ||
}; | ||
: baseCopy(source, keys(source), object); | ||
} | ||
module.exports = baseAssign; |
@@ -17,3 +17,3 @@ var isArrayLike = require('./isArrayLike'), | ||
isArr = !isNil && isArrayLike(collection), | ||
length = isArr && collection.length, | ||
length = isArr ? collection.length : 0, | ||
propsLength = props.length, | ||
@@ -20,0 +20,0 @@ result = Array(propsLength); |
@@ -6,4 +6,4 @@ /** | ||
* @private | ||
* @param {*} value The value to compare to `other`. | ||
* @param {*} other The value to compare to `value`. | ||
* @param {*} value The value to compare. | ||
* @param {*} other The other value to compare. | ||
* @returns {number} Returns the sort order indicator for `value`. | ||
@@ -13,9 +13,18 @@ */ | ||
if (value !== other) { | ||
var valIsReflexive = value === value, | ||
var valIsNull = value === null, | ||
valIsUndef = value === undefined, | ||
valIsReflexive = value === value; | ||
var othIsNull = other === null, | ||
othIsUndef = other === undefined, | ||
othIsReflexive = other === other; | ||
if (value > other || !valIsReflexive || (value === undefined && othIsReflexive)) { | ||
if ((value > other && !othIsNull) || !valIsReflexive || | ||
(valIsNull && !othIsUndef && othIsReflexive) || | ||
(valIsUndef && othIsReflexive)) { | ||
return 1; | ||
} | ||
if (value < other || !othIsReflexive || (other === undefined && valIsReflexive)) { | ||
if ((value < other && !valIsNull) || !othIsReflexive || | ||
(othIsNull && !valIsUndef && valIsReflexive) || | ||
(othIsUndef && valIsReflexive)) { | ||
return -1; | ||
@@ -22,0 +31,0 @@ } |
@@ -12,10 +12,10 @@ var isObject = require('../lang/isObject'); | ||
var baseCreate = (function() { | ||
function Object() {} | ||
function object() {} | ||
return function(prototype) { | ||
if (isObject(prototype)) { | ||
Object.prototype = prototype; | ||
var result = new Object; | ||
Object.prototype = null; | ||
object.prototype = prototype; | ||
var result = new object; | ||
object.prototype = null; | ||
} | ||
return result || global.Object(); | ||
return result || {}; | ||
}; | ||
@@ -22,0 +22,0 @@ }()); |
@@ -20,7 +20,7 @@ var toObject = require('./toObject'); | ||
} | ||
var index = -1, | ||
var index = 0, | ||
length = path.length; | ||
while (object != null && ++index < length) { | ||
object = object[path[index]]; | ||
while (object != null && index < length) { | ||
object = object[path[index++]]; | ||
} | ||
@@ -27,0 +27,0 @@ return (index && index == length) ? object : undefined; |
@@ -1,2 +0,3 @@ | ||
var baseIsEqualDeep = require('./baseIsEqualDeep'); | ||
var baseIsEqualDeep = require('./baseIsEqualDeep'), | ||
isObject = require('../lang/isObject'); | ||
@@ -17,13 +18,6 @@ /** | ||
function baseIsEqual(value, other, customizer, isLoose, stackA, stackB) { | ||
// Exit early for identical values. | ||
if (value === other) { | ||
return true; | ||
} | ||
var valType = typeof value, | ||
othType = typeof other; | ||
// Exit early for unlike primitive values. | ||
if ((valType != 'function' && valType != 'object' && othType != 'function' && othType != 'object') || | ||
value == null || other == null) { | ||
// Return `false` unless both values are `NaN`. | ||
if (value == null || other == null || (!isObject(value) && !isObject(other))) { | ||
return value !== value && other !== other; | ||
@@ -30,0 +24,0 @@ } |
@@ -69,7 +69,7 @@ var equalArrays = require('./equalArrays'), | ||
if (!isLoose) { | ||
var valWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), | ||
othWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); | ||
var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), | ||
othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); | ||
if (valWrapped || othWrapped) { | ||
return equalFunc(valWrapped ? object.value() : object, othWrapped ? other.value() : other, customizer, isLoose, stackA, stackB); | ||
if (objIsWrapped || othIsWrapped) { | ||
return equalFunc(objIsWrapped ? object.value() : object, othIsWrapped ? other.value() : other, customizer, isLoose, stackA, stackB); | ||
} | ||
@@ -76,0 +76,0 @@ } |
@@ -1,2 +0,3 @@ | ||
var baseIsEqual = require('./baseIsEqual'); | ||
var baseIsEqual = require('./baseIsEqual'), | ||
toObject = require('./toObject'); | ||
@@ -9,17 +10,20 @@ /** | ||
* @param {Object} object The object to inspect. | ||
* @param {Array} props The source property names to match. | ||
* @param {Array} values The source values to match. | ||
* @param {Array} strictCompareFlags Strict comparison flags for source values. | ||
* @param {Array} matchData The propery names, values, and compare flags to match. | ||
* @param {Function} [customizer] The function to customize comparing objects. | ||
* @returns {boolean} Returns `true` if `object` is a match, else `false`. | ||
*/ | ||
function baseIsMatch(object, props, values, strictCompareFlags, customizer) { | ||
var index = -1, | ||
length = props.length, | ||
function baseIsMatch(object, matchData, customizer) { | ||
var index = matchData.length, | ||
length = index, | ||
noCustomizer = !customizer; | ||
while (++index < length) { | ||
if ((noCustomizer && strictCompareFlags[index]) | ||
? values[index] !== object[props[index]] | ||
: !(props[index] in object) | ||
if (object == null) { | ||
return !length; | ||
} | ||
object = toObject(object); | ||
while (index--) { | ||
var data = matchData[index]; | ||
if ((noCustomizer && data[2]) | ||
? data[1] !== object[data[0]] | ||
: !(data[0] in object) | ||
) { | ||
@@ -29,19 +33,18 @@ return false; | ||
} | ||
index = -1; | ||
while (++index < length) { | ||
var key = props[index], | ||
data = matchData[index]; | ||
var key = data[0], | ||
objValue = object[key], | ||
srcValue = values[index]; | ||
srcValue = data[1]; | ||
if (noCustomizer && strictCompareFlags[index]) { | ||
var result = objValue !== undefined || (key in object); | ||
if (noCustomizer && data[2]) { | ||
if (objValue === undefined && !(key in object)) { | ||
return false; | ||
} | ||
} else { | ||
result = customizer ? customizer(objValue, srcValue, key) : undefined; | ||
if (result === undefined) { | ||
result = baseIsEqual(srcValue, objValue, customizer, true); | ||
var result = customizer ? customizer(objValue, srcValue, key) : undefined; | ||
if (!(result === undefined ? baseIsEqual(srcValue, objValue, customizer, true) : result)) { | ||
return false; | ||
} | ||
} | ||
if (!result) { | ||
return false; | ||
} | ||
} | ||
@@ -48,0 +51,0 @@ return true; |
var baseIsMatch = require('./baseIsMatch'), | ||
constant = require('../utility/constant'), | ||
isStrictComparable = require('./isStrictComparable'), | ||
keys = require('../object/keys'), | ||
getMatchData = require('./getMatchData'), | ||
toObject = require('./toObject'); | ||
@@ -15,31 +13,16 @@ | ||
function baseMatches(source) { | ||
var props = keys(source), | ||
length = props.length; | ||
var matchData = getMatchData(source); | ||
if (matchData.length == 1 && matchData[0][2]) { | ||
var key = matchData[0][0], | ||
value = matchData[0][1]; | ||
if (!length) { | ||
return constant(true); | ||
return function(object) { | ||
if (object == null) { | ||
return false; | ||
} | ||
return object[key] === value && (value !== undefined || (key in toObject(object))); | ||
}; | ||
} | ||
if (length == 1) { | ||
var key = props[0], | ||
value = source[key]; | ||
if (isStrictComparable(value)) { | ||
return function(object) { | ||
if (object == null) { | ||
return false; | ||
} | ||
return object[key] === value && (value !== undefined || (key in toObject(object))); | ||
}; | ||
} | ||
} | ||
var values = Array(length), | ||
strictCompareFlags = Array(length); | ||
while (length--) { | ||
value = source[props[length]]; | ||
values[length] = value; | ||
strictCompareFlags[length] = isStrictComparable(value); | ||
} | ||
return function(object) { | ||
return object != null && baseIsMatch(toObject(object), props, values, strictCompareFlags); | ||
return baseIsMatch(object, matchData); | ||
}; | ||
@@ -46,0 +29,0 @@ } |
@@ -17,8 +17,8 @@ var baseGet = require('./baseGet'), | ||
* @param {string} path The path of the property to get. | ||
* @param {*} value The value to compare. | ||
* @param {*} srcValue The value to compare. | ||
* @returns {Function} Returns the new function. | ||
*/ | ||
function baseMatchesProperty(path, value) { | ||
function baseMatchesProperty(path, srcValue) { | ||
var isArr = isArray(path), | ||
isCommon = isKey(path) && isStrictComparable(value), | ||
isCommon = isKey(path) && isStrictComparable(srcValue), | ||
pathKey = (path + ''); | ||
@@ -41,5 +41,5 @@ | ||
} | ||
return object[key] === value | ||
? (value !== undefined || (key in object)) | ||
: baseIsEqual(value, object[key], null, true); | ||
return object[key] === srcValue | ||
? (srcValue !== undefined || (key in object)) | ||
: baseIsEqual(srcValue, object[key], undefined, true); | ||
}; | ||
@@ -46,0 +46,0 @@ } |
var arrayEach = require('./arrayEach'), | ||
baseMergeDeep = require('./baseMergeDeep'), | ||
getSymbols = require('./getSymbols'), | ||
isArray = require('../lang/isArray'), | ||
@@ -11,8 +10,2 @@ isArrayLike = require('./isArrayLike'), | ||
/** Used for native method references. */ | ||
var arrayProto = Array.prototype; | ||
/** Native method references. */ | ||
var push = arrayProto.push; | ||
/** | ||
@@ -34,7 +27,5 @@ * The base implementation of `_.merge` without support for argument juggling, | ||
} | ||
var isSrcArr = isArrayLike(source) && (isArray(source) || isTypedArray(source)); | ||
if (!isSrcArr) { | ||
var props = keys(source); | ||
push.apply(props, getSymbols(source)); | ||
} | ||
var isSrcArr = isArrayLike(source) && (isArray(source) || isTypedArray(source)), | ||
props = isSrcArr ? null : keys(source); | ||
arrayEach(props || source, function(srcValue, key) { | ||
@@ -58,3 +49,3 @@ if (props) { | ||
} | ||
if ((isSrcArr || result !== undefined) && | ||
if ((result !== undefined || (isSrcArr && !(key in object))) && | ||
(isCommon || (result === result ? (result !== value) : (value === value)))) { | ||
@@ -61,0 +52,0 @@ object[key] = result; |
@@ -21,3 +21,3 @@ var isIndex = require('./isIndex'); | ||
while (length--) { | ||
var index = parseFloat(indexes[length]); | ||
var index = indexes[length]; | ||
if (index != previous && isIndex(index)) { | ||
@@ -24,0 +24,0 @@ var previous = index; |
/** | ||
* Converts `value` to a string if it is not one. An empty string is returned | ||
* Converts `value` to a string if it's not one. An empty string is returned | ||
* for `null` or `undefined` values. | ||
@@ -4,0 +4,0 @@ * |
@@ -5,3 +5,3 @@ var binaryIndexBy = require('./binaryIndexBy'), | ||
/** Used as references for the maximum length and index of an array. */ | ||
var MAX_ARRAY_LENGTH = Math.pow(2, 32) - 1, | ||
var MAX_ARRAY_LENGTH = 4294967295, | ||
HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1; | ||
@@ -29,3 +29,3 @@ | ||
if (retHighest ? (computed <= value) : (computed < value)) { | ||
if ((retHighest ? (computed <= value) : (computed < value)) && computed !== null) { | ||
low = mid + 1; | ||
@@ -32,0 +32,0 @@ } else { |
@@ -8,3 +8,3 @@ /** Native method references. */ | ||
/** Used as references for the maximum length and index of an array. */ | ||
var MAX_ARRAY_LENGTH = Math.pow(2, 32) - 1, | ||
var MAX_ARRAY_LENGTH = 4294967295, | ||
MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1; | ||
@@ -31,2 +31,3 @@ | ||
valIsNaN = value !== value, | ||
valIsNull = value === null, | ||
valIsUndef = value === undefined; | ||
@@ -37,2 +38,3 @@ | ||
computed = iteratee(array[mid]), | ||
isDef = computed !== undefined, | ||
isReflexive = computed === computed; | ||
@@ -42,4 +44,8 @@ | ||
var setLow = isReflexive || retHighest; | ||
} else if (valIsNull) { | ||
setLow = isReflexive && isDef && (retHighest || computed != null); | ||
} else if (valIsUndef) { | ||
setLow = isReflexive && (retHighest || computed !== undefined); | ||
setLow = isReflexive && (retHighest || isDef); | ||
} else if (computed == null) { | ||
setLow = false; | ||
} else { | ||
@@ -46,0 +52,0 @@ setLow = retHighest ? (computed <= value) : (computed < value); |
var constant = require('../utility/constant'), | ||
isNative = require('../lang/isNative'); | ||
getNative = require('./getNative'); | ||
/** Native method references. */ | ||
var ArrayBuffer = isNative(ArrayBuffer = global.ArrayBuffer) && ArrayBuffer, | ||
bufferSlice = isNative(bufferSlice = ArrayBuffer && new ArrayBuffer(0).slice) && bufferSlice, | ||
var ArrayBuffer = getNative(root, 'ArrayBuffer'), | ||
bufferSlice = getNative(ArrayBuffer && new ArrayBuffer(0), 'slice'), | ||
floor = Math.floor, | ||
Uint8Array = isNative(Uint8Array = global.Uint8Array) && Uint8Array; | ||
Uint8Array = getNative(root, 'Uint8Array'); | ||
@@ -16,6 +16,6 @@ /** Used to clone array buffers. */ | ||
try { | ||
var func = isNative(func = global.Float64Array) && func, | ||
var func = getNative(root, 'Float64Array'), | ||
result = new func(new ArrayBuffer(10), 0, 1) && func; | ||
} catch(e) {} | ||
return result; | ||
return result || null; | ||
}()); | ||
@@ -22,0 +22,0 @@ |
@@ -19,5 +19,5 @@ var bindCallback = require('./bindCallback'), | ||
length = object == null ? 0 : sources.length, | ||
customizer = length > 2 && sources[length - 2], | ||
guard = length > 2 && sources[2], | ||
thisArg = length > 1 && sources[length - 1]; | ||
customizer = length > 2 ? sources[length - 2] : undefined, | ||
guard = length > 2 ? sources[2] : undefined, | ||
thisArg = length > 1 ? sources[length - 1] : undefined; | ||
@@ -28,7 +28,7 @@ if (typeof customizer == 'function') { | ||
} else { | ||
customizer = typeof thisArg == 'function' ? thisArg : null; | ||
customizer = typeof thisArg == 'function' ? thisArg : undefined; | ||
length -= (customizer ? 1 : 0); | ||
} | ||
if (guard && isIterateeCall(sources[0], sources[1], guard)) { | ||
customizer = length < 3 ? null : customizer; | ||
customizer = length < 3 ? undefined : customizer; | ||
length = 1; | ||
@@ -35,0 +35,0 @@ } |
var SetCache = require('./SetCache'), | ||
constant = require('../utility/constant'), | ||
isNative = require('../lang/isNative'); | ||
getNative = require('./getNative'); | ||
/** Native method references. */ | ||
var Set = isNative(Set = global.Set) && Set; | ||
var Set = getNative(root, 'Set'); | ||
/* Native method references for those with the same name as other `lodash` methods. */ | ||
var nativeCreate = isNative(nativeCreate = Object.create) && nativeCreate; | ||
var nativeCreate = getNative(Object, 'create'); | ||
@@ -11,0 +11,0 @@ /** |
@@ -14,4 +14,16 @@ var baseCreate = require('./baseCreate'), | ||
return function() { | ||
// Use a `switch` statement to work with class constructors. | ||
// See https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-function-objects-call-thisargument-argumentslist | ||
// for more details. | ||
var args = arguments; | ||
switch (args.length) { | ||
case 0: return new Ctor; | ||
case 1: return new Ctor(args[0]); | ||
case 2: return new Ctor(args[0], args[1]); | ||
case 3: return new Ctor(args[0], args[1], args[2]); | ||
case 4: return new Ctor(args[0], args[1], args[2], args[3]); | ||
case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]); | ||
} | ||
var thisBinding = baseCreate(Ctor.prototype), | ||
result = Ctor.apply(thisBinding, arguments); | ||
result = Ctor.apply(thisBinding, args); | ||
@@ -18,0 +30,0 @@ // Mimic the constructor's `return` behavior. |
@@ -1,7 +0,5 @@ | ||
var baseCallback = require('./baseCallback'), | ||
charAtCallback = require('./charAtCallback'), | ||
extremumBy = require('./extremumBy'), | ||
isArray = require('../lang/isArray'), | ||
var arrayExtremum = require('./arrayExtremum'), | ||
baseCallback = require('./baseCallback'), | ||
baseExtremum = require('./baseExtremum'), | ||
isIterateeCall = require('./isIterateeCall'), | ||
isString = require('../lang/isString'), | ||
toIterable = require('./toIterable'); | ||
@@ -13,8 +11,7 @@ | ||
* @private | ||
* @param {Function} arrayFunc The function to get the extremum value from an array. | ||
* @param {boolean} [isMin] Specify returning the minimum, instead of the maximum, | ||
* extremum value. | ||
* @param {Function} comparator The function used to compare values. | ||
* @param {*} exValue The initial extremum value. | ||
* @returns {Function} Returns the new extremum function. | ||
*/ | ||
function createExtremum(arrayFunc, isMin) { | ||
function createExtremum(comparator, exValue) { | ||
return function(collection, iteratee, thisArg) { | ||
@@ -24,14 +21,11 @@ if (thisArg && isIterateeCall(collection, iteratee, thisArg)) { | ||
} | ||
var noIteratee = iteratee == null; | ||
iteratee = noIteratee ? iteratee : baseCallback(iteratee, thisArg, 3); | ||
if (noIteratee) { | ||
var isArr = isArray(collection); | ||
if (!isArr && isString(collection)) { | ||
iteratee = charAtCallback; | ||
} else { | ||
return arrayFunc(isArr ? collection : toIterable(collection)); | ||
iteratee = baseCallback(iteratee, thisArg, 3); | ||
if (iteratee.length == 1) { | ||
collection = toIterable(collection); | ||
var result = arrayExtremum(collection, iteratee, comparator, exValue); | ||
if (!(collection.length && result === exValue)) { | ||
return result; | ||
} | ||
} | ||
return extremumBy(collection, iteratee, isMin); | ||
return baseExtremum(collection, iteratee, comparator, exValue); | ||
}; | ||
@@ -38,0 +32,0 @@ } |
@@ -25,7 +25,4 @@ var LodashWrapper = require('./LodashWrapper'), | ||
return function() { | ||
var length = arguments.length; | ||
if (!length) { | ||
return function() { return arguments[0]; }; | ||
} | ||
var wrapper, | ||
length = arguments.length, | ||
index = fromRight ? length : -1, | ||
@@ -40,4 +37,5 @@ leftIndex = 0, | ||
} | ||
var funcName = wrapper ? '' : getFuncName(func); | ||
wrapper = funcName == 'wrapper' ? new LodashWrapper([]) : wrapper; | ||
if (!wrapper && LodashWrapper.prototype.thru && getFuncName(func) == 'wrapper') { | ||
wrapper = new LodashWrapper([]); | ||
} | ||
} | ||
@@ -47,5 +45,6 @@ index = wrapper ? -1 : length; | ||
func = funcs[index]; | ||
funcName = getFuncName(func); | ||
var data = funcName == 'wrapper' ? getData(func) : null; | ||
var funcName = getFuncName(func), | ||
data = funcName == 'wrapper' ? getData(func) : null; | ||
if (data && isLaziable(data[0]) && data[1] == (ARY_FLAG | CURRY_FLAG | PARTIAL_FLAG | REARG_FLAG) && !data[4].length && data[9] == 1) { | ||
@@ -63,3 +62,3 @@ wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]); | ||
var index = 0, | ||
result = funcs[index].apply(this, args); | ||
result = length ? funcs[index].apply(this, args) : args[0]; | ||
@@ -66,0 +65,0 @@ while (++index < length) { |
@@ -46,7 +46,5 @@ var arrayCopy = require('./arrayCopy'), | ||
isCurryBound = bitmask & CURRY_BOUND_FLAG, | ||
isCurryRight = bitmask & CURRY_RIGHT_FLAG; | ||
isCurryRight = bitmask & CURRY_RIGHT_FLAG, | ||
Ctor = isBindKey ? null : createCtorWrapper(func); | ||
var Ctor = !isBindKey && createCtorWrapper(func), | ||
key = func; | ||
function wrapper() { | ||
@@ -97,6 +95,5 @@ // Avoid `arguments` object use disqualifying optimizations by | ||
} | ||
var thisBinding = isBind ? thisArg : this; | ||
if (isBindKey) { | ||
func = thisBinding[key]; | ||
} | ||
var thisBinding = isBind ? thisArg : this, | ||
fn = isBindKey ? thisBinding[func] : func; | ||
if (argPos) { | ||
@@ -108,3 +105,5 @@ args = reorder(args, argPos); | ||
} | ||
var fn = (this && this !== global && this instanceof wrapper) ? (Ctor || createCtorWrapper(func)) : func; | ||
if (this && this !== global && this instanceof wrapper) { | ||
fn = Ctor || createCtorWrapper(func); | ||
} | ||
return fn.apply(thisBinding, args); | ||
@@ -111,0 +110,0 @@ } |
@@ -0,1 +1,3 @@ | ||
var arraySome = require('./arraySome'); | ||
/** | ||
@@ -18,4 +20,3 @@ * A specialized version of `baseIsEqualDeep` for arrays with support for | ||
arrLength = array.length, | ||
othLength = other.length, | ||
result = true; | ||
othLength = other.length; | ||
@@ -25,32 +26,28 @@ if (arrLength != othLength && !(isLoose && othLength > arrLength)) { | ||
} | ||
// Deep compare the contents, ignoring non-numeric properties. | ||
while (result && ++index < arrLength) { | ||
// Ignore non-index properties. | ||
while (++index < arrLength) { | ||
var arrValue = array[index], | ||
othValue = other[index]; | ||
othValue = other[index], | ||
result = customizer ? customizer(isLoose ? othValue : arrValue, isLoose ? arrValue : othValue, index) : undefined; | ||
result = undefined; | ||
if (customizer) { | ||
result = isLoose | ||
? customizer(othValue, arrValue, index) | ||
: customizer(arrValue, othValue, index); | ||
if (result !== undefined) { | ||
if (result) { | ||
continue; | ||
} | ||
return false; | ||
} | ||
if (result === undefined) { | ||
// Recursively compare arrays (susceptible to call stack limits). | ||
if (isLoose) { | ||
var othIndex = othLength; | ||
while (othIndex--) { | ||
othValue = other[othIndex]; | ||
result = (arrValue && arrValue === othValue) || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB); | ||
if (result) { | ||
break; | ||
} | ||
} | ||
} else { | ||
result = (arrValue && arrValue === othValue) || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB); | ||
// Recursively compare arrays (susceptible to call stack limits). | ||
if (isLoose) { | ||
if (!arraySome(other, function(othValue) { | ||
return arrValue === othValue || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB); | ||
})) { | ||
return false; | ||
} | ||
} else if (!(arrValue === othValue || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB))) { | ||
return false; | ||
} | ||
} | ||
return !!result; | ||
return true; | ||
} | ||
module.exports = equalArrays; |
@@ -32,25 +32,18 @@ var keys = require('../object/keys'); | ||
} | ||
var skipCtor = isLoose, | ||
index = -1; | ||
var index = objLength; | ||
while (index--) { | ||
var key = objProps[index]; | ||
if (!(isLoose ? key in other : hasOwnProperty.call(other, key))) { | ||
return false; | ||
} | ||
} | ||
var skipCtor = isLoose; | ||
while (++index < objLength) { | ||
var key = objProps[index], | ||
result = isLoose ? key in other : hasOwnProperty.call(other, key); | ||
key = objProps[index]; | ||
var objValue = object[key], | ||
othValue = other[key], | ||
result = customizer ? customizer(isLoose ? othValue : objValue, isLoose? objValue : othValue, key) : undefined; | ||
if (result) { | ||
var objValue = object[key], | ||
othValue = other[key]; | ||
result = undefined; | ||
if (customizer) { | ||
result = isLoose | ||
? customizer(othValue, objValue, key) | ||
: customizer(objValue, othValue, key); | ||
} | ||
if (result === undefined) { | ||
// Recursively compare objects (susceptible to call stack limits). | ||
result = (objValue && objValue === othValue) || equalFunc(objValue, othValue, customizer, isLoose, stackA, stackB); | ||
} | ||
} | ||
if (!result) { | ||
// Recursively compare objects (susceptible to call stack limits). | ||
if (!(result === undefined ? equalFunc(objValue, othValue, customizer, isLoose, stackA, stackB) : result)) { | ||
return false; | ||
@@ -57,0 +50,0 @@ } |
@@ -1,5 +0,2 @@ | ||
var baseProperty = require('./baseProperty'), | ||
constant = require('../utility/constant'), | ||
realNames = require('./realNames'), | ||
support = require('../support'); | ||
var realNames = require('./realNames'); | ||
@@ -13,26 +10,17 @@ /** | ||
*/ | ||
var getFuncName = (function() { | ||
if (!support.funcNames) { | ||
return constant(''); | ||
} | ||
if (constant.name == 'constant') { | ||
return baseProperty('name'); | ||
} | ||
return function(func) { | ||
var result = func.name, | ||
array = realNames[result], | ||
length = array ? array.length : 0; | ||
function getFuncName(func) { | ||
var result = func.name, | ||
array = realNames[result], | ||
length = array ? array.length : 0; | ||
while (length--) { | ||
var data = array[length], | ||
otherFunc = data.func; | ||
if (otherFunc == null || otherFunc == func) { | ||
return data.name; | ||
} | ||
while (length--) { | ||
var data = array[length], | ||
otherFunc = data.func; | ||
if (otherFunc == null || otherFunc == func) { | ||
return data.name; | ||
} | ||
return result; | ||
}; | ||
}()); | ||
} | ||
return result; | ||
} | ||
module.exports = getFuncName; |
@@ -5,3 +5,3 @@ /** | ||
*/ | ||
var MAX_SAFE_INTEGER = Math.pow(2, 53) - 1; | ||
var MAX_SAFE_INTEGER = 9007199254740991; | ||
@@ -17,3 +17,3 @@ /** | ||
function isIndex(value, length) { | ||
value = +value; | ||
value = typeof value == 'number' ? value : parseFloat(value); | ||
length = length == null ? MAX_SAFE_INTEGER : length; | ||
@@ -20,0 +20,0 @@ return value > -1 && value % 1 == 0 && value < length; |
@@ -5,3 +5,3 @@ /** | ||
*/ | ||
var MAX_SAFE_INTEGER = Math.pow(2, 53) - 1; | ||
var MAX_SAFE_INTEGER = 9007199254740991; | ||
@@ -8,0 +8,0 @@ /** |
@@ -1,5 +0,5 @@ | ||
var isNative = require('../lang/isNative'); | ||
var getNative = require('./getNative'); | ||
/** Native method references. */ | ||
var WeakMap = isNative(WeakMap = global.WeakMap) && WeakMap; | ||
var WeakMap = getNative(root, 'WeakMap'); | ||
@@ -6,0 +6,0 @@ /** Used to store function metadata. */ |
var cachePush = require('./cachePush'), | ||
isNative = require('../lang/isNative'); | ||
getNative = require('./getNative'); | ||
/** Native method references. */ | ||
var Set = isNative(Set = global.Set) && Set; | ||
var Set = getNative(root, 'Set'); | ||
/* Native method references for those with the same name as other `lodash` methods. */ | ||
var nativeCreate = isNative(nativeCreate = Object.create) && nativeCreate; | ||
var nativeCreate = getNative(Object, 'create'); | ||
@@ -10,0 +10,0 @@ /** |
@@ -5,4 +5,3 @@ var isArguments = require('../lang/isArguments'), | ||
isLength = require('./isLength'), | ||
keysIn = require('../object/keysIn'), | ||
support = require('../support'); | ||
keysIn = require('../object/keysIn'); | ||
@@ -28,4 +27,4 @@ /** Used for native method references. */ | ||
var allowIndexes = length && isLength(length) && | ||
(isArray(object) || (support.nonEnumArgs && isArguments(object))); | ||
var allowIndexes = !!length && isLength(length) && | ||
(isArray(object) || isArguments(object)); | ||
@@ -32,0 +31,0 @@ var index = -1, |
@@ -6,3 +6,3 @@ var isArrayLike = require('./isArrayLike'), | ||
/** | ||
* Converts `value` to an array-like object if it is not one. | ||
* Converts `value` to an array-like object if it's not one. | ||
* | ||
@@ -9,0 +9,0 @@ * @private |
var isObject = require('../lang/isObject'); | ||
/** | ||
* Converts `value` to an object if it is not one. | ||
* Converts `value` to an object if it's not one. | ||
* | ||
@@ -6,0 +6,0 @@ * @private |
@@ -11,3 +11,3 @@ var baseToString = require('./baseToString'), | ||
/** | ||
* Converts `value` to property path array if it is not one. | ||
* Converts `value` to property path array if it's not one. | ||
* | ||
@@ -14,0 +14,0 @@ * @private |
module.exports = { | ||
'clone': require('./lang/clone'), | ||
'cloneDeep': require('./lang/cloneDeep'), | ||
'eq': require('./lang/eq'), | ||
'gt': require('./lang/gt'), | ||
'gte': require('./lang/gte'), | ||
'isArguments': require('./lang/isArguments'), | ||
@@ -25,4 +28,6 @@ 'isArray': require('./lang/isArray'), | ||
'isUndefined': require('./lang/isUndefined'), | ||
'lt': require('./lang/lt'), | ||
'lte': require('./lang/lte'), | ||
'toArray': require('./lang/toArray'), | ||
'toPlainObject': require('./lang/toPlainObject') | ||
}; |
@@ -65,6 +65,7 @@ var baseClone = require('../internal/baseClone'), | ||
} | ||
customizer = typeof customizer == 'function' && bindCallback(customizer, thisArg, 1); | ||
return baseClone(value, isDeep, customizer); | ||
return typeof customizer == 'function' | ||
? baseClone(value, isDeep, bindCallback(customizer, thisArg, 1)) | ||
: baseClone(value, isDeep); | ||
} | ||
module.exports = clone; |
@@ -50,6 +50,7 @@ var baseClone = require('../internal/baseClone'), | ||
function cloneDeep(value, customizer, thisArg) { | ||
customizer = typeof customizer == 'function' && bindCallback(customizer, thisArg, 1); | ||
return baseClone(value, true, customizer); | ||
return typeof customizer == 'function' | ||
? baseClone(value, true, bindCallback(customizer, thisArg, 1)) | ||
: baseClone(value, true); | ||
} | ||
module.exports = cloneDeep; |
@@ -1,3 +0,3 @@ | ||
var isLength = require('../internal/isLength'), | ||
isNative = require('./isNative'), | ||
var getNative = require('../internal/getNative'), | ||
isLength = require('../internal/isLength'), | ||
isObjectLike = require('../internal/isObjectLike'); | ||
@@ -18,3 +18,3 @@ | ||
/* Native method references for those with the same name as other `lodash` methods. */ | ||
var nativeIsArray = isNative(nativeIsArray = Array.isArray) && nativeIsArray; | ||
var nativeIsArray = getNative(Array, 'isArray'); | ||
@@ -21,0 +21,0 @@ /** |
var baseIsEqual = require('../internal/baseIsEqual'), | ||
bindCallback = require('../internal/bindCallback'), | ||
isStrictComparable = require('../internal/isStrictComparable'); | ||
bindCallback = require('../internal/bindCallback'); | ||
@@ -20,2 +19,3 @@ /** | ||
* @memberOf _ | ||
* @alias eq | ||
* @category Lang | ||
@@ -50,10 +50,7 @@ * @param {*} value The value to compare. | ||
function isEqual(value, other, customizer, thisArg) { | ||
customizer = typeof customizer == 'function' && bindCallback(customizer, thisArg, 3); | ||
if (!customizer && isStrictComparable(value) && isStrictComparable(other)) { | ||
return value === other; | ||
} | ||
customizer = typeof customizer == 'function' ? bindCallback(customizer, thisArg, 3) : undefined; | ||
var result = customizer ? customizer(value, other) : undefined; | ||
return result === undefined ? baseIsEqual(value, other, customizer) : !!result; | ||
return result === undefined ? baseIsEqual(value, other, customizer) : !!result; | ||
} | ||
module.exports = isEqual; |
@@ -1,6 +0,6 @@ | ||
var isNative = require('./isNative'); | ||
var getNative = require('../internal/getNative'); | ||
/* Native method references for those with the same name as other `lodash` methods. */ | ||
var nativeIsFinite = global.isFinite, | ||
nativeNumIsFinite = isNative(nativeNumIsFinite = Number.isFinite) && nativeNumIsFinite; | ||
nativeNumIsFinite = getNative(Number, 'isFinite'); | ||
@@ -7,0 +7,0 @@ /** |
var baseIsFunction = require('../internal/baseIsFunction'), | ||
isNative = require('./isNative'); | ||
getNative = require('../internal/getNative'); | ||
@@ -17,3 +17,3 @@ /** `Object#toString` result references. */ | ||
/** Native method references. */ | ||
var Uint8Array = isNative(Uint8Array = global.Uint8Array) && Uint8Array; | ||
var Uint8Array = getNative(root, 'Uint8Array'); | ||
@@ -20,0 +20,0 @@ /** |
var baseIsMatch = require('../internal/baseIsMatch'), | ||
bindCallback = require('../internal/bindCallback'), | ||
isStrictComparable = require('../internal/isStrictComparable'), | ||
keys = require('../object/keys'), | ||
toObject = require('../internal/toObject'); | ||
getMatchData = require('../internal/getMatchData'); | ||
@@ -47,31 +45,6 @@ /** | ||
function isMatch(object, source, customizer, thisArg) { | ||
var props = keys(source), | ||
length = props.length; | ||
if (!length) { | ||
return true; | ||
} | ||
if (object == null) { | ||
return false; | ||
} | ||
customizer = typeof customizer == 'function' && bindCallback(customizer, thisArg, 3); | ||
object = toObject(object); | ||
if (!customizer && length == 1) { | ||
var key = props[0], | ||
value = source[key]; | ||
if (isStrictComparable(value)) { | ||
return value === object[key] && (value !== undefined || (key in object)); | ||
} | ||
} | ||
var values = Array(length), | ||
strictCompareFlags = Array(length); | ||
while (length--) { | ||
value = values[length] = source[props[length]]; | ||
strictCompareFlags[length] = isStrictComparable(value); | ||
} | ||
return baseIsMatch(object, props, values, strictCompareFlags, customizer); | ||
customizer = typeof customizer == 'function' ? bindCallback(customizer, thisArg, 3) : undefined; | ||
return baseIsMatch(object, getMatchData(source), customizer); | ||
} | ||
module.exports = isMatch; |
@@ -16,2 +16,5 @@ var escapeRegExp = require('../string/escapeRegExp'), | ||
/** Used to check objects for own properties. */ | ||
var hasOwnProperty = objectProto.hasOwnProperty; | ||
/** | ||
@@ -25,4 +28,4 @@ * Used to resolve the [`toStringTag`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) | ||
var reIsNative = RegExp('^' + | ||
escapeRegExp(objToString) | ||
.replace(/toString|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' | ||
escapeRegExp(fnToString.call(hasOwnProperty)) | ||
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' | ||
); | ||
@@ -29,0 +32,0 @@ |
@@ -25,5 +25,5 @@ /** | ||
var type = typeof value; | ||
return type == 'function' || (!!value && type == 'object'); | ||
return !!value && (type == 'object' || type == 'function'); | ||
} | ||
module.exports = isObject; |
@@ -1,2 +0,2 @@ | ||
var isNative = require('./isNative'), | ||
var getNative = require('../internal/getNative'), | ||
shimIsPlainObject = require('../internal/shimIsPlainObject'); | ||
@@ -17,3 +17,3 @@ | ||
/** Native method references. */ | ||
var getPrototypeOf = isNative(getPrototypeOf = Object.getPrototypeOf) && getPrototypeOf; | ||
var getPrototypeOf = getNative(Object, 'getPrototypeOf'); | ||
@@ -54,4 +54,4 @@ /** | ||
} | ||
var valueOf = value.valueOf, | ||
objProto = isNative(valueOf) && (objProto = getPrototypeOf(valueOf)) && getPrototypeOf(objProto); | ||
var valueOf = getNative(value, 'valueOf'), | ||
objProto = valueOf && (objProto = getPrototypeOf(valueOf)) && getPrototypeOf(objProto); | ||
@@ -58,0 +58,0 @@ return objProto |
@@ -1,3 +0,3 @@ | ||
var arrayMax = require('../internal/arrayMax'), | ||
createExtremum = require('../internal/createExtremum'); | ||
var createExtremum = require('../internal/createExtremum'), | ||
gt = require('../lang/gt'); | ||
@@ -51,4 +51,4 @@ /** | ||
*/ | ||
var max = createExtremum(arrayMax); | ||
var max = createExtremum(gt, -Infinity); | ||
module.exports = max; |
@@ -1,3 +0,3 @@ | ||
var arrayMin = require('../internal/arrayMin'), | ||
createExtremum = require('../internal/createExtremum'); | ||
var createExtremum = require('../internal/createExtremum'), | ||
lt = require('../lang/lt'); | ||
@@ -51,4 +51,4 @@ /** | ||
*/ | ||
var min = createExtremum(arrayMin, true); | ||
var min = createExtremum(lt, Infinity); | ||
module.exports = min; |
@@ -5,3 +5,3 @@ var baseGet = require('../internal/baseGet'), | ||
/** | ||
* Gets the property value of `path` on `object`. If the resolved value is | ||
* Gets the property value at `path` of `object`. If the resolved value is | ||
* `undefined` the `defaultValue` is used in its place. | ||
@@ -8,0 +8,0 @@ * |
var baseGet = require('../internal/baseGet'), | ||
baseSlice = require('../internal/baseSlice'), | ||
isArguments = require('../lang/isArguments'), | ||
isArray = require('../lang/isArray'), | ||
isIndex = require('../internal/isIndex'), | ||
isKey = require('../internal/isKey'), | ||
isLength = require('../internal/isLength'), | ||
last = require('../array/last'), | ||
@@ -43,8 +47,12 @@ toPath = require('../internal/toPath'); | ||
object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1)); | ||
if (object == null) { | ||
return false; | ||
} | ||
path = last(path); | ||
result = object != null && hasOwnProperty.call(object, path); | ||
result = hasOwnProperty.call(object, path); | ||
} | ||
return result; | ||
return result || (isLength(object.length) && isIndex(path, object.length) && | ||
(isArray(object) || isArguments(object))); | ||
} | ||
module.exports = has; |
@@ -1,3 +0,3 @@ | ||
var isArrayLike = require('../internal/isArrayLike'), | ||
isNative = require('../lang/isNative'), | ||
var getNative = require('../internal/getNative'), | ||
isArrayLike = require('../internal/isArrayLike'), | ||
isObject = require('../lang/isObject'), | ||
@@ -7,3 +7,3 @@ shimKeys = require('../internal/shimKeys'); | ||
/* Native method references for those with the same name as other `lodash` methods. */ | ||
var nativeKeys = isNative(nativeKeys = Object.keys) && nativeKeys; | ||
var nativeKeys = getNative(Object, 'keys'); | ||
@@ -38,3 +38,3 @@ /** | ||
var keys = !nativeKeys ? shimKeys : function(object) { | ||
var Ctor = object != null && object.constructor; | ||
var Ctor = object == null ? null : object.constructor; | ||
if ((typeof Ctor == 'function' && Ctor.prototype === object) || | ||
@@ -41,0 +41,0 @@ (typeof object != 'function' && isArrayLike(object))) { |
@@ -5,4 +5,3 @@ var isArguments = require('../lang/isArguments'), | ||
isLength = require('../internal/isLength'), | ||
isObject = require('../lang/isObject'), | ||
support = require('../support'); | ||
isObject = require('../lang/isObject'); | ||
@@ -46,3 +45,3 @@ /** Used for native method references. */ | ||
length = (length && isLength(length) && | ||
(isArray(object) || (support.nonEnumArgs && isArguments(object))) && length) || 0; | ||
(isArray(object) || isArguments(object)) && length) || 0; | ||
@@ -49,0 +48,0 @@ var Ctor = object.constructor, |
@@ -1,2 +0,3 @@ | ||
var keys = require('./keys'); | ||
var keys = require('./keys'), | ||
toObject = require('../internal/toObject'); | ||
@@ -18,2 +19,4 @@ /** | ||
function pairs(object) { | ||
object = toObject(object); | ||
var index = -1, | ||
@@ -20,0 +23,0 @@ props = keys(object), |
@@ -49,3 +49,3 @@ var arrayEach = require('../internal/arrayEach'), | ||
} else { | ||
accumulator = baseCreate(isFunction(Ctor) && Ctor.prototype); | ||
accumulator = baseCreate(isFunction(Ctor) ? Ctor.prototype : null); | ||
} | ||
@@ -52,0 +52,0 @@ } else { |
{ | ||
"name": "lodash", | ||
"version": "3.8.0", | ||
"version": "3.9.0", | ||
"description": "The modern build of lodash modular utilities.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://lodash.com/", |
@@ -1,2 +0,2 @@ | ||
# lodash v3.8.0 | ||
# lodash v3.9.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.8.0-npm) for more details. | ||
See the [package source](https://github.com/lodash/lodash/tree/3.9.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.8.0-amd) & [compatibility](https://github.com/lodash/lodash-compat/tree/3.8.0-amd) builds | ||
* ES modules for the [modern](https://github.com/lodash/lodash/tree/3.8.0-es) build | ||
* AMD modules for [modern](https://github.com/lodash/lodash/tree/3.9.0-amd) & [compatibility](https://github.com/lodash/lodash-compat/tree/3.9.0-amd) builds | ||
* ES modules for the [modern](https://github.com/lodash/lodash/tree/3.9.0-es) build | ||
@@ -80,2 +80,3 @@ ## Further Reading | ||
* [_.get](https://lodash.com/docs#get) & [_.set](https://lodash.com/docs#set) for deep property getting & setting | ||
* [_.gt](https://lodash.com/docs#gt), [_.gte](https://lodash.com/docs#gte), [_.lt](https://lodash.com/docs#lt), & [_.lte](https://lodash.com/docs#lte) relational methods | ||
* [_.inRange](https://lodash.com/docs#inRange) for checking whether a number is within a given range | ||
@@ -121,3 +122,3 @@ * [_.isNative](https://lodash.com/docs#isNative) to check for native functions | ||
Tested in Chrome 41-42, Firefox 36-37, IE 6-11, MS Edge, Opera 27-28, Safari 5-8, io.js 1.8.1, Node.js 0.8.28, 0.10.38, & 0.12.2, PhantomJS 1.9.8, RingoJS 0.11, & Rhino 1.7RC5. | ||
Tested in Chrome 41-42, Firefox 37-38, IE 6-11, MS Edge, Opera 28-29, Safari 5-8, ChakraNode 0.12.2, io.js 2.0.2, Node.js 0.8.28, 0.10.38, & 0.12.3, PhantomJS 1.9.8, RingoJS 0.11, & Rhino 1.7.6 | ||
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. |
@@ -16,3 +16,3 @@ var baseToString = require('../internal/baseToString'), | ||
* Though the ">" character is escaped for symmetry, characters like | ||
* ">" and "/" don't require escaping in HTML and have no special meaning | ||
* ">" and "/" don't need escaping in HTML and have no special meaning | ||
* unless they're part of a tag or unquoted attribute value. | ||
@@ -19,0 +19,0 @@ * See [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands) |
@@ -12,3 +12,3 @@ var baseToString = require('../internal/baseToString'), | ||
/** | ||
* Pads `string` on the left and right sides if it is shorter than `length`. | ||
* Pads `string` on the left and right sides if it's shorter than `length`. | ||
* Padding characters are truncated if they can't be evenly divided by `length`. | ||
@@ -15,0 +15,0 @@ * |
var createPadDir = require('../internal/createPadDir'); | ||
/** | ||
* Pads `string` on the left side if it is shorter than `length`. Padding | ||
* Pads `string` on the left side if it's shorter than `length`. Padding | ||
* characters are truncated if they exceed `length`. | ||
@@ -6,0 +6,0 @@ * |
var createPadDir = require('../internal/createPadDir'); | ||
/** | ||
* Pads `string` on the right side if it is shorter than `length`. Padding | ||
* Pads `string` on the right side if it's shorter than `length`. Padding | ||
* characters are truncated if they exceed `length`. | ||
@@ -6,0 +6,0 @@ * |
@@ -14,3 +14,3 @@ var baseToString = require('../internal/baseToString'), | ||
/** | ||
* Truncates `string` if it is longer than the given maximum string length. | ||
* Truncates `string` if it's longer than the given maximum string length. | ||
* The last characters of the truncated string are replaced with the omission | ||
@@ -17,0 +17,0 @@ * string which defaults to "...". |
@@ -1,10 +0,4 @@ | ||
/** Used for native method references. */ | ||
var objectProto = Object.prototype; | ||
/** Used to detect DOM support. */ | ||
var document = (document = global.window) && document.document; | ||
var document = (document = global.window) ? document.document : null; | ||
/** Native method references. */ | ||
var propertyIsEnumerable = objectProto.propertyIsEnumerable; | ||
/** | ||
@@ -21,3 +15,2 @@ * An object environment feature flags. | ||
var Ctor = function() { this.x = x; }, | ||
args = arguments, | ||
object = { '0': x, 'length': x }, | ||
@@ -30,20 +23,2 @@ props = []; | ||
/** | ||
* Detect if functions can be decompiled by `Function#toString` | ||
* (all but Firefox OS certified apps, older Opera mobile browsers, and | ||
* the PlayStation 3; forced `false` for Windows 8 apps). | ||
* | ||
* @memberOf _.support | ||
* @type boolean | ||
*/ | ||
support.funcDecomp = /\bthis\b/.test(function() { return this; }); | ||
/** | ||
* Detect if `Function#name` is supported (all but IE). | ||
* | ||
* @memberOf _.support | ||
* @type boolean | ||
*/ | ||
support.funcNames = typeof Function.name == 'string'; | ||
/** | ||
* Detect if the DOM is supported. | ||
@@ -59,22 +34,4 @@ * | ||
} | ||
/** | ||
* Detect if `arguments` object indexes are non-enumerable. | ||
* | ||
* In Firefox < 4, IE < 9, PhantomJS, and Safari < 5.1 `arguments` object | ||
* indexes are non-enumerable. Chrome < 25 and Node.js < 0.11.0 treat | ||
* `arguments` object indexes as non-enumerable and fail `hasOwnProperty` | ||
* checks for indexes that exceed the number of function parameters and | ||
* whose associated argument values are `0`. | ||
* | ||
* @memberOf _.support | ||
* @type boolean | ||
*/ | ||
try { | ||
support.nonEnumArgs = !propertyIsEnumerable.call(args, 1); | ||
} catch(e) { | ||
support.nonEnumArgs = true; | ||
} | ||
}(1, 0)); | ||
module.exports = support; |
@@ -16,3 +16,3 @@ var baseClone = require('../internal/baseClone'), | ||
* @param {Array|string} path The path of the property to get. | ||
* @param {*} value The value to compare. | ||
* @param {*} srcValue The value to match. | ||
* @returns {Function} Returns the new function. | ||
@@ -29,6 +29,6 @@ * @example | ||
*/ | ||
function matchesProperty(path, value) { | ||
return baseMatchesProperty(path, baseClone(value, true)); | ||
function matchesProperty(path, srcValue) { | ||
return baseMatchesProperty(path, baseClone(srcValue, true)); | ||
} | ||
module.exports = matchesProperty; |
@@ -38,5 +38,2 @@ var arrayCopy = require('../internal/arrayCopy'), | ||
* | ||
* // use `_.runInContext` to avoid conflicts (esp. in Node.js) | ||
* var _ = require('lodash').runInContext(); | ||
* | ||
* _.mixin({ 'vowels': vowels }); | ||
@@ -43,0 +40,0 @@ * _.vowels('fred'); |
@@ -11,3 +11,3 @@ var bindCallback = require('../internal/bindCallback'); | ||
/** Used as references for the maximum length and index of an array. */ | ||
var MAX_ARRAY_LENGTH = Math.pow(2, 32) - 1; | ||
var MAX_ARRAY_LENGTH = 4294967295; | ||
@@ -14,0 +14,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
409
121
830497
24067