Comparing version 3.10.1 to 4.0.0
103
array.js
module.exports = { | ||
'chunk': require('./array/chunk'), | ||
'compact': require('./array/compact'), | ||
'difference': require('./array/difference'), | ||
'drop': require('./array/drop'), | ||
'dropRight': require('./array/dropRight'), | ||
'dropRightWhile': require('./array/dropRightWhile'), | ||
'dropWhile': require('./array/dropWhile'), | ||
'fill': require('./array/fill'), | ||
'findIndex': require('./array/findIndex'), | ||
'findLastIndex': require('./array/findLastIndex'), | ||
'first': require('./array/first'), | ||
'flatten': require('./array/flatten'), | ||
'flattenDeep': require('./array/flattenDeep'), | ||
'head': require('./array/head'), | ||
'indexOf': require('./array/indexOf'), | ||
'initial': require('./array/initial'), | ||
'intersection': require('./array/intersection'), | ||
'last': require('./array/last'), | ||
'lastIndexOf': require('./array/lastIndexOf'), | ||
'object': require('./array/object'), | ||
'pull': require('./array/pull'), | ||
'pullAt': require('./array/pullAt'), | ||
'remove': require('./array/remove'), | ||
'rest': require('./array/rest'), | ||
'slice': require('./array/slice'), | ||
'sortedIndex': require('./array/sortedIndex'), | ||
'sortedLastIndex': require('./array/sortedLastIndex'), | ||
'tail': require('./array/tail'), | ||
'take': require('./array/take'), | ||
'takeRight': require('./array/takeRight'), | ||
'takeRightWhile': require('./array/takeRightWhile'), | ||
'takeWhile': require('./array/takeWhile'), | ||
'union': require('./array/union'), | ||
'uniq': require('./array/uniq'), | ||
'unique': require('./array/unique'), | ||
'unzip': require('./array/unzip'), | ||
'unzipWith': require('./array/unzipWith'), | ||
'without': require('./array/without'), | ||
'xor': require('./array/xor'), | ||
'zip': require('./array/zip'), | ||
'zipObject': require('./array/zipObject'), | ||
'zipWith': require('./array/zipWith') | ||
'chunk': require('./chunk'), | ||
'compact': require('./compact'), | ||
'concat': require('./concat'), | ||
'difference': require('./difference'), | ||
'differenceBy': require('./differenceBy'), | ||
'differenceWith': require('./differenceWith'), | ||
'drop': require('./drop'), | ||
'dropRight': require('./dropRight'), | ||
'dropRightWhile': require('./dropRightWhile'), | ||
'dropWhile': require('./dropWhile'), | ||
'fill': require('./fill'), | ||
'findIndex': require('./findIndex'), | ||
'findLastIndex': require('./findLastIndex'), | ||
'flatMap': require('./flatMap'), | ||
'flatten': require('./flatten'), | ||
'flattenDeep': require('./flattenDeep'), | ||
'fromPairs': require('./fromPairs'), | ||
'head': require('./head'), | ||
'indexOf': require('./indexOf'), | ||
'initial': require('./initial'), | ||
'intersection': require('./intersection'), | ||
'intersectionBy': require('./intersectionBy'), | ||
'intersectionWith': require('./intersectionWith'), | ||
'join': require('./join'), | ||
'last': require('./last'), | ||
'lastIndexOf': require('./lastIndexOf'), | ||
'pull': require('./pull'), | ||
'pullAll': require('./pullAll'), | ||
'pullAllBy': require('./pullAllBy'), | ||
'pullAt': require('./pullAt'), | ||
'remove': require('./remove'), | ||
'reverse': require('./reverse'), | ||
'slice': require('./slice'), | ||
'sortedIndex': require('./sortedIndex'), | ||
'sortedIndexBy': require('./sortedIndexBy'), | ||
'sortedIndexOf': require('./sortedIndexOf'), | ||
'sortedLastIndex': require('./sortedLastIndex'), | ||
'sortedLastIndexBy': require('./sortedLastIndexBy'), | ||
'sortedLastIndexOf': require('./sortedLastIndexOf'), | ||
'sortedUniq': require('./sortedUniq'), | ||
'sortedUniqBy': require('./sortedUniqBy'), | ||
'tail': require('./tail'), | ||
'take': require('./take'), | ||
'takeRight': require('./takeRight'), | ||
'takeRightWhile': require('./takeRightWhile'), | ||
'takeWhile': require('./takeWhile'), | ||
'union': require('./union'), | ||
'unionBy': require('./unionBy'), | ||
'unionWith': require('./unionWith'), | ||
'uniq': require('./uniq'), | ||
'uniqBy': require('./uniqBy'), | ||
'uniqWith': require('./uniqWith'), | ||
'unzip': require('./unzip'), | ||
'unzipWith': require('./unzipWith'), | ||
'without': require('./without'), | ||
'xor': require('./xor'), | ||
'xorBy': require('./xorBy'), | ||
'xorWith': require('./xorWith'), | ||
'zip': require('./zip'), | ||
'zipObject': require('./zipObject'), | ||
'zipWith': require('./zipWith') | ||
}; |
52
chain.js
@@ -1,16 +0,36 @@ | ||
module.exports = { | ||
'chain': require('./chain/chain'), | ||
'commit': require('./chain/commit'), | ||
'concat': require('./chain/concat'), | ||
'lodash': require('./chain/lodash'), | ||
'plant': require('./chain/plant'), | ||
'reverse': require('./chain/reverse'), | ||
'run': require('./chain/run'), | ||
'tap': require('./chain/tap'), | ||
'thru': require('./chain/thru'), | ||
'toJSON': require('./chain/toJSON'), | ||
'toString': require('./chain/toString'), | ||
'value': require('./chain/value'), | ||
'valueOf': require('./chain/valueOf'), | ||
'wrapperChain': require('./chain/wrapperChain') | ||
}; | ||
var lodash = require('./wrapperLodash'); | ||
/** | ||
* Creates a `lodash` object that wraps `value` with explicit method chaining enabled. | ||
* The result of such method chaining must be unwrapped with `_#value`. | ||
* | ||
* @static | ||
* @memberOf _ | ||
* @category Seq | ||
* @param {*} value The value to wrap. | ||
* @returns {Object} Returns the new `lodash` wrapper instance. | ||
* @example | ||
* | ||
* var users = [ | ||
* { 'user': 'barney', 'age': 36 }, | ||
* { 'user': 'fred', 'age': 40 }, | ||
* { 'user': 'pebbles', 'age': 1 } | ||
* ]; | ||
* | ||
* var youngest = _ | ||
* .chain(users) | ||
* .sortBy('age') | ||
* .map(function(o) { | ||
* return o.user + ' is ' + o.age; | ||
* }) | ||
* .head() | ||
* .value(); | ||
* // => 'pebbles is 1' | ||
*/ | ||
function chain(value) { | ||
var result = lodash(value); | ||
result.__chain__ = true; | ||
return result; | ||
} | ||
module.exports = chain; |
module.exports = { | ||
'all': require('./collection/all'), | ||
'any': require('./collection/any'), | ||
'at': require('./collection/at'), | ||
'collect': require('./collection/collect'), | ||
'contains': require('./collection/contains'), | ||
'countBy': require('./collection/countBy'), | ||
'detect': require('./collection/detect'), | ||
'each': require('./collection/each'), | ||
'eachRight': require('./collection/eachRight'), | ||
'every': require('./collection/every'), | ||
'filter': require('./collection/filter'), | ||
'find': require('./collection/find'), | ||
'findLast': require('./collection/findLast'), | ||
'findWhere': require('./collection/findWhere'), | ||
'foldl': require('./collection/foldl'), | ||
'foldr': require('./collection/foldr'), | ||
'forEach': require('./collection/forEach'), | ||
'forEachRight': require('./collection/forEachRight'), | ||
'groupBy': require('./collection/groupBy'), | ||
'include': require('./collection/include'), | ||
'includes': require('./collection/includes'), | ||
'indexBy': require('./collection/indexBy'), | ||
'inject': require('./collection/inject'), | ||
'invoke': require('./collection/invoke'), | ||
'map': require('./collection/map'), | ||
'max': require('./math/max'), | ||
'min': require('./math/min'), | ||
'partition': require('./collection/partition'), | ||
'pluck': require('./collection/pluck'), | ||
'reduce': require('./collection/reduce'), | ||
'reduceRight': require('./collection/reduceRight'), | ||
'reject': require('./collection/reject'), | ||
'sample': require('./collection/sample'), | ||
'select': require('./collection/select'), | ||
'shuffle': require('./collection/shuffle'), | ||
'size': require('./collection/size'), | ||
'some': require('./collection/some'), | ||
'sortBy': require('./collection/sortBy'), | ||
'sortByAll': require('./collection/sortByAll'), | ||
'sortByOrder': require('./collection/sortByOrder'), | ||
'sum': require('./math/sum'), | ||
'where': require('./collection/where') | ||
'at': require('./at'), | ||
'countBy': require('./countBy'), | ||
'each': require('./each'), | ||
'eachRight': require('./eachRight'), | ||
'every': require('./every'), | ||
'filter': require('./filter'), | ||
'find': require('./find'), | ||
'findLast': require('./findLast'), | ||
'forEach': require('./forEach'), | ||
'forEachRight': require('./forEachRight'), | ||
'groupBy': require('./groupBy'), | ||
'includes': require('./includes'), | ||
'invokeMap': require('./invokeMap'), | ||
'keyBy': require('./keyBy'), | ||
'map': require('./map'), | ||
'orderBy': require('./orderBy'), | ||
'partition': require('./partition'), | ||
'reduce': require('./reduce'), | ||
'reduceRight': require('./reduceRight'), | ||
'reject': require('./reject'), | ||
'sample': require('./sample'), | ||
'sampleSize': require('./sampleSize'), | ||
'shuffle': require('./shuffle'), | ||
'size': require('./size'), | ||
'some': require('./some'), | ||
'sortBy': require('./sortBy') | ||
}; |
module.exports = { | ||
'now': require('./date/now') | ||
'now': require('./now') | ||
}; |
module.exports = { | ||
'after': require('./function/after'), | ||
'ary': require('./function/ary'), | ||
'backflow': require('./function/backflow'), | ||
'before': require('./function/before'), | ||
'bind': require('./function/bind'), | ||
'bindAll': require('./function/bindAll'), | ||
'bindKey': require('./function/bindKey'), | ||
'compose': require('./function/compose'), | ||
'curry': require('./function/curry'), | ||
'curryRight': require('./function/curryRight'), | ||
'debounce': require('./function/debounce'), | ||
'defer': require('./function/defer'), | ||
'delay': require('./function/delay'), | ||
'flow': require('./function/flow'), | ||
'flowRight': require('./function/flowRight'), | ||
'memoize': require('./function/memoize'), | ||
'modArgs': require('./function/modArgs'), | ||
'negate': require('./function/negate'), | ||
'once': require('./function/once'), | ||
'partial': require('./function/partial'), | ||
'partialRight': require('./function/partialRight'), | ||
'rearg': require('./function/rearg'), | ||
'restParam': require('./function/restParam'), | ||
'spread': require('./function/spread'), | ||
'throttle': require('./function/throttle'), | ||
'wrap': require('./function/wrap') | ||
'after': require('./after'), | ||
'ary': require('./ary'), | ||
'before': require('./before'), | ||
'bind': require('./bind'), | ||
'bindKey': require('./bindKey'), | ||
'curry': require('./curry'), | ||
'curryRight': require('./curryRight'), | ||
'debounce': require('./debounce'), | ||
'defer': require('./defer'), | ||
'delay': require('./delay'), | ||
'flip': require('./flip'), | ||
'memoize': require('./memoize'), | ||
'negate': require('./negate'), | ||
'once': require('./once'), | ||
'overArgs': require('./overArgs'), | ||
'partial': require('./partial'), | ||
'partialRight': require('./partialRight'), | ||
'rearg': require('./rearg'), | ||
'rest': require('./rest'), | ||
'spread': require('./spread'), | ||
'throttle': require('./throttle'), | ||
'unary': require('./unary'), | ||
'wrap': require('./wrap') | ||
}; |
/** | ||
* Creates a new array joining `array` with `other`. | ||
* Creates a new array concatenating `array` with `other`. | ||
* | ||
* @private | ||
* @param {Array} array The array to join. | ||
* @param {Array} other The other array to join. | ||
* @param {Array} array The first array to concatenate. | ||
* @param {Array} other The second array to concatenate. | ||
* @returns {Array} Returns the new concatenated array. | ||
@@ -8,0 +8,0 @@ */ |
/** | ||
* A specialized version of `_.forEach` for arrays without support for callback | ||
* shorthands and `this` binding. | ||
* A specialized version of `_.forEach` for arrays without support for | ||
* iteratee shorthands. | ||
* | ||
@@ -5,0 +5,0 @@ * @private |
/** | ||
* A specialized version of `_.forEachRight` for arrays without support for | ||
* callback shorthands and `this` binding. | ||
* iteratee shorthands. | ||
* | ||
@@ -5,0 +5,0 @@ * @private |
/** | ||
* A specialized version of `_.every` for arrays without support for callback | ||
* shorthands and `this` binding. | ||
* A specialized version of `_.every` for arrays without support for | ||
* iteratee shorthands. | ||
* | ||
@@ -8,4 +8,3 @@ * @private | ||
* @param {Function} predicate The function invoked per iteration. | ||
* @returns {boolean} Returns `true` if all elements pass the predicate check, | ||
* else `false`. | ||
* @returns {boolean} Returns `true` if all elements pass the predicate check, else `false`. | ||
*/ | ||
@@ -12,0 +11,0 @@ function arrayEvery(array, predicate) { |
/** | ||
* A specialized version of `_.filter` for arrays without support for callback | ||
* shorthands and `this` binding. | ||
* A specialized version of `_.filter` for arrays without support for | ||
* iteratee shorthands. | ||
* | ||
@@ -5,0 +5,0 @@ * @private |
/** | ||
* A specialized version of `_.map` for arrays without support for callback | ||
* shorthands and `this` binding. | ||
* A specialized version of `_.map` for arrays without support for iteratee | ||
* shorthands. | ||
* | ||
@@ -5,0 +5,0 @@ * @private |
/** | ||
* A specialized version of `_.reduce` for arrays without support for callback | ||
* shorthands and `this` binding. | ||
* A specialized version of `_.reduce` for arrays without support for | ||
* iteratee shorthands. | ||
* | ||
@@ -9,4 +9,3 @@ * @private | ||
* @param {*} [accumulator] The initial value. | ||
* @param {boolean} [initFromArray] Specify using the first element of `array` | ||
* as the initial value. | ||
* @param {boolean} [initFromArray] Specify using the first element of `array` as the initial value. | ||
* @returns {*} Returns the accumulated value. | ||
@@ -13,0 +12,0 @@ */ |
/** | ||
* A specialized version of `_.reduceRight` for arrays without support for | ||
* callback shorthands and `this` binding. | ||
* iteratee shorthands. | ||
* | ||
@@ -9,4 +9,3 @@ * @private | ||
* @param {*} [accumulator] The initial value. | ||
* @param {boolean} [initFromArray] Specify using the last element of `array` | ||
* as the initial value. | ||
* @param {boolean} [initFromArray] Specify using the last element of `array` as the initial value. | ||
* @returns {*} Returns the accumulated value. | ||
@@ -13,0 +12,0 @@ */ |
/** | ||
* A specialized version of `_.some` for arrays without support for callback | ||
* shorthands and `this` binding. | ||
* A specialized version of `_.some` for arrays without support for iteratee | ||
* shorthands. | ||
* | ||
@@ -8,4 +8,3 @@ * @private | ||
* @param {Function} predicate The function invoked per iteration. | ||
* @returns {boolean} Returns `true` if any element passes the predicate check, | ||
* else `false`. | ||
* @returns {boolean} Returns `true` if any element passes the predicate check, else `false`. | ||
*/ | ||
@@ -12,0 +11,0 @@ function arraySome(array, predicate) { |
@@ -1,7 +0,7 @@ | ||
var baseCopy = require('./baseCopy'), | ||
keys = require('../object/keys'); | ||
var copyObject = require('./copyObject'), | ||
keys = require('../keys'); | ||
/** | ||
* The base implementation of `_.assign` without support for argument juggling, | ||
* multiple sources, and `customizer` functions. | ||
* The base implementation of `_.assign` without support for multiple sources | ||
* or `customizer` functions. | ||
* | ||
@@ -14,7 +14,5 @@ * @private | ||
function baseAssign(object, source) { | ||
return source == null | ||
? object | ||
: baseCopy(source, keys(source), object); | ||
return object && copyObject(source, keys(source), object); | ||
} | ||
module.exports = baseAssign; |
@@ -1,28 +0,19 @@ | ||
var isArrayLike = require('./isArrayLike'), | ||
isIndex = require('./isIndex'); | ||
var get = require('../get'); | ||
/** | ||
* The base implementation of `_.at` without support for string collections | ||
* and individual key arguments. | ||
* The base implementation of `_.at` without support for individual paths. | ||
* | ||
* @private | ||
* @param {Array|Object} collection The collection to iterate over. | ||
* @param {number[]|string[]} props The property names or indexes of elements to pick. | ||
* @param {Object} object The object to iterate over. | ||
* @param {string[]} paths The property paths of elements to pick. | ||
* @returns {Array} Returns the new array of picked elements. | ||
*/ | ||
function baseAt(collection, props) { | ||
function baseAt(object, paths) { | ||
var index = -1, | ||
isNil = collection == null, | ||
isArr = !isNil && isArrayLike(collection), | ||
length = isArr ? collection.length : 0, | ||
propsLength = props.length, | ||
result = Array(propsLength); | ||
isNil = object == null, | ||
length = paths.length, | ||
result = Array(length); | ||
while(++index < propsLength) { | ||
var key = props[index]; | ||
if (isArr) { | ||
result[index] = isIndex(key, length) ? collection[key] : undefined; | ||
} else { | ||
result[index] = isNil ? undefined : collection[key]; | ||
} | ||
while (++index < length) { | ||
result[index] = isNil ? undefined : get(object, paths[index]); | ||
} | ||
@@ -29,0 +20,0 @@ return result; |
@@ -1,10 +0,15 @@ | ||
var arrayCopy = require('./arrayCopy'), | ||
var Stack = require('./Stack'), | ||
arrayEach = require('./arrayEach'), | ||
assignValue = require('./assignValue'), | ||
baseAssign = require('./baseAssign'), | ||
baseForOwn = require('./baseForOwn'), | ||
copyArray = require('./copyArray'), | ||
copySymbols = require('./copySymbols'), | ||
getTag = require('./getTag'), | ||
initCloneArray = require('./initCloneArray'), | ||
initCloneByTag = require('./initCloneByTag'), | ||
initCloneObject = require('./initCloneObject'), | ||
isArray = require('../lang/isArray'), | ||
isObject = require('../lang/isObject'); | ||
isArray = require('../isArray'), | ||
isHostObject = require('./isHostObject'), | ||
isObject = require('../isObject'); | ||
@@ -18,2 +23,3 @@ /** `Object#toString` result references. */ | ||
funcTag = '[object Function]', | ||
genTag = '[object GeneratorFunction]', | ||
mapTag = '[object Map]', | ||
@@ -25,2 +31,3 @@ numberTag = '[object Number]', | ||
stringTag = '[object String]', | ||
symbolTag = '[object Symbol]', | ||
weakMapTag = '[object WeakMap]'; | ||
@@ -46,22 +53,14 @@ | ||
cloneableTags[int16Tag] = cloneableTags[int32Tag] = | ||
cloneableTags[numberTag] = cloneableTags[objectTag] = | ||
cloneableTags[regexpTag] = cloneableTags[stringTag] = | ||
cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = | ||
cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; | ||
cloneableTags[mapTag] = cloneableTags[numberTag] = | ||
cloneableTags[objectTag] = cloneableTags[regexpTag] = | ||
cloneableTags[setTag] = cloneableTags[stringTag] = | ||
cloneableTags[symbolTag] = cloneableTags[uint8Tag] = | ||
cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = | ||
cloneableTags[uint32Tag] = true; | ||
cloneableTags[errorTag] = cloneableTags[funcTag] = | ||
cloneableTags[mapTag] = cloneableTags[setTag] = | ||
cloneableTags[weakMapTag] = false; | ||
/** Used for native method references. */ | ||
var objectProto = Object.prototype; | ||
/** | ||
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) | ||
* of values. | ||
*/ | ||
var objToString = objectProto.toString; | ||
/** | ||
* The base implementation of `_.clone` without support for argument juggling | ||
* and `this` binding `customizer` functions. | ||
* The base implementation of `_.clone` and `_.cloneDeep` which tracks | ||
* traversed objects. | ||
* | ||
@@ -71,13 +70,12 @@ * @private | ||
* @param {boolean} [isDeep] Specify a deep clone. | ||
* @param {Function} [customizer] The function to customize cloning values. | ||
* @param {Function} [customizer] The function to customize cloning. | ||
* @param {string} [key] The key of `value`. | ||
* @param {Object} [object] The object `value` belongs to. | ||
* @param {Array} [stackA=[]] Tracks traversed source objects. | ||
* @param {Array} [stackB=[]] Associates clones with source counterparts. | ||
* @param {Object} [object] The parent object of `value`. | ||
* @param {Object} [stack] Tracks traversed objects and their clone counterparts. | ||
* @returns {*} Returns the cloned value. | ||
*/ | ||
function baseClone(value, isDeep, customizer, key, object, stackA, stackB) { | ||
function baseClone(value, isDeep, customizer, key, object, stack) { | ||
var result; | ||
if (customizer) { | ||
result = object ? customizer(value, key, object) : customizer(value); | ||
result = object ? customizer(value, key, object, stack) : customizer(value); | ||
} | ||
@@ -94,12 +92,15 @@ if (result !== undefined) { | ||
if (!isDeep) { | ||
return arrayCopy(value, result); | ||
return copyArray(value, result); | ||
} | ||
} else { | ||
var tag = objToString.call(value), | ||
isFunc = tag == funcTag; | ||
var tag = getTag(value), | ||
isFunc = tag == funcTag || tag == genTag; | ||
if (tag == objectTag || tag == argsTag || (isFunc && !object)) { | ||
if (isHostObject(value)) { | ||
return object ? value : {}; | ||
} | ||
result = initCloneObject(isFunc ? {} : value); | ||
if (!isDeep) { | ||
return baseAssign(result, value); | ||
return copySymbols(value, baseAssign(result, value)); | ||
} | ||
@@ -113,22 +114,16 @@ } else { | ||
// Check for circular references and return its corresponding clone. | ||
stackA || (stackA = []); | ||
stackB || (stackB = []); | ||
var length = stackA.length; | ||
while (length--) { | ||
if (stackA[length] == value) { | ||
return stackB[length]; | ||
} | ||
stack || (stack = new Stack); | ||
var stacked = stack.get(value); | ||
if (stacked) { | ||
return stacked; | ||
} | ||
// Add the source value to the stack of traversed objects and associate it with its clone. | ||
stackA.push(value); | ||
stackB.push(result); | ||
stack.set(value, result); | ||
// Recursively populate clone (susceptible to call stack limits). | ||
(isArr ? arrayEach : baseForOwn)(value, function(subValue, key) { | ||
result[key] = baseClone(subValue, isDeep, customizer, key, value, stackA, stackB); | ||
assignValue(result, key, baseClone(subValue, isDeep, customizer, key, value, stack)); | ||
}); | ||
return result; | ||
return isArr ? result : copySymbols(value, result); | ||
} | ||
module.exports = baseClone; |
@@ -1,2 +0,2 @@ | ||
var isObject = require('../lang/isObject'); | ||
var isObject = require('../isObject'); | ||
@@ -3,0 +3,0 @@ /** |
@@ -5,4 +5,4 @@ /** Used as the `TypeError` message for "Functions" methods. */ | ||
/** | ||
* The base implementation of `_.delay` and `_.defer` which accepts an index | ||
* of where to slice the arguments to provide to `func`. | ||
* The base implementation of `_.delay` and `_.defer` which accepts an array | ||
* of `func` arguments. | ||
* | ||
@@ -9,0 +9,0 @@ * @private |
@@ -1,4 +0,7 @@ | ||
var baseIndexOf = require('./baseIndexOf'), | ||
cacheIndexOf = require('./cacheIndexOf'), | ||
createCache = require('./createCache'); | ||
var SetCache = require('./SetCache'), | ||
arrayIncludes = require('./arrayIncludes'), | ||
arrayIncludesWith = require('./arrayIncludesWith'), | ||
arrayMap = require('./arrayMap'), | ||
baseUnary = require('./baseUnary'), | ||
cacheHas = require('./cacheHas'); | ||
@@ -9,4 +12,4 @@ /** Used as the size to enable large array optimizations. */ | ||
/** | ||
* The base implementation of `_.difference` which accepts a single array | ||
* of values to exclude. | ||
* The base implementation of methods like `_.difference` without support for | ||
* excluding multiple arrays or iteratee shorthands. | ||
* | ||
@@ -16,7 +19,13 @@ * @private | ||
* @param {Array} values The values to exclude. | ||
* @param {Function} [iteratee] The iteratee invoked per element. | ||
* @param {Function} [comparator] The comparator invoked per element. | ||
* @returns {Array} Returns the new array of filtered values. | ||
*/ | ||
function baseDifference(array, values) { | ||
var length = array ? array.length : 0, | ||
result = []; | ||
function baseDifference(array, values, iteratee, comparator) { | ||
var index = -1, | ||
includes = arrayIncludes, | ||
isCommon = true, | ||
length = array.length, | ||
result = [], | ||
valuesLength = values.length; | ||
@@ -26,21 +35,23 @@ if (!length) { | ||
} | ||
var index = -1, | ||
indexOf = baseIndexOf, | ||
isCommon = true, | ||
cache = (isCommon && values.length >= LARGE_ARRAY_SIZE) ? createCache(values) : null, | ||
valuesLength = values.length; | ||
if (cache) { | ||
indexOf = cacheIndexOf; | ||
if (iteratee) { | ||
values = arrayMap(values, baseUnary(iteratee)); | ||
} | ||
if (comparator) { | ||
includes = arrayIncludesWith; | ||
isCommon = false; | ||
values = cache; | ||
} | ||
else if (values.length >= LARGE_ARRAY_SIZE) { | ||
includes = cacheHas; | ||
isCommon = false; | ||
values = new SetCache(values); | ||
} | ||
outer: | ||
while (++index < length) { | ||
var value = array[index]; | ||
var value = array[index], | ||
computed = iteratee ? iteratee(value) : value; | ||
if (isCommon && value === value) { | ||
if (isCommon && computed === computed) { | ||
var valuesIndex = valuesLength; | ||
while (valuesIndex--) { | ||
if (values[valuesIndex] === value) { | ||
if (values[valuesIndex] === computed) { | ||
continue outer; | ||
@@ -51,3 +62,3 @@ } | ||
} | ||
else if (indexOf(values, value, 0) < 0) { | ||
else if (!includes(values, computed, comparator)) { | ||
result.push(value); | ||
@@ -54,0 +65,0 @@ } |
@@ -5,9 +5,8 @@ var baseForOwn = require('./baseForOwn'), | ||
/** | ||
* The base implementation of `_.forEach` without support for callback | ||
* shorthands and `this` binding. | ||
* The base implementation of `_.forEach` without support for iteratee shorthands. | ||
* | ||
* @private | ||
* @param {Array|Object|string} collection The collection to iterate over. | ||
* @param {Array|Object} collection The collection to iterate over. | ||
* @param {Function} iteratee The function invoked per iteration. | ||
* @returns {Array|Object|string} Returns `collection`. | ||
* @returns {Array|Object} Returns `collection`. | ||
*/ | ||
@@ -14,0 +13,0 @@ var baseEach = createBaseEach(baseForOwn); |
@@ -5,9 +5,8 @@ var baseForOwnRight = require('./baseForOwnRight'), | ||
/** | ||
* The base implementation of `_.forEachRight` without support for callback | ||
* shorthands and `this` binding. | ||
* The base implementation of `_.forEachRight` without support for iteratee shorthands. | ||
* | ||
* @private | ||
* @param {Array|Object|string} collection The collection to iterate over. | ||
* @param {Array|Object} collection The collection to iterate over. | ||
* @param {Function} iteratee The function invoked per iteration. | ||
* @returns {Array|Object|string} Returns `collection`. | ||
* @returns {Array|Object} Returns `collection`. | ||
*/ | ||
@@ -14,0 +13,0 @@ var baseEachRight = createBaseEach(baseForOwnRight, true); |
var baseEach = require('./baseEach'); | ||
/** | ||
* The base implementation of `_.every` without support for callback | ||
* shorthands and `this` binding. | ||
* The base implementation of `_.every` without support for iteratee shorthands. | ||
* | ||
* @private | ||
* @param {Array|Object|string} collection The collection to iterate over. | ||
* @param {Array|Object} collection The collection to iterate over. | ||
* @param {Function} predicate The function invoked per iteration. | ||
* @returns {boolean} Returns `true` if all elements pass the predicate check, | ||
* else `false` | ||
* @returns {boolean} Returns `true` if all elements pass the predicate check, else `false` | ||
*/ | ||
@@ -13,0 +11,0 @@ function baseEvery(collection, predicate) { |
@@ -1,26 +0,27 @@ | ||
var baseEach = require('./baseEach'); | ||
/** | ||
* Gets the extremum value of `collection` invoking `iteratee` for each value | ||
* in `collection` to generate the criterion by which the value is ranked. | ||
* The `iteratee` is invoked with three arguments: (value, index|key, collection). | ||
* The base implementation of methods like `_.max` and `_.min` which accepts a | ||
* `comparator` to determine the extremum value. | ||
* | ||
* @private | ||
* @param {Array|Object|string} collection The collection to iterate over. | ||
* @param {Function} iteratee The function invoked per iteration. | ||
* @param {Function} comparator The function used to compare values. | ||
* @param {*} exValue The initial extremum value. | ||
* @param {Array} array The array to iterate over. | ||
* @param {Function} iteratee The iteratee invoked per iteration. | ||
* @param {Function} comparator The comparator used to compare values. | ||
* @returns {*} Returns the extremum value. | ||
*/ | ||
function baseExtremum(collection, iteratee, comparator, exValue) { | ||
var computed = exValue, | ||
result = computed; | ||
function baseExtremum(array, iteratee, comparator) { | ||
var index = -1, | ||
length = array.length; | ||
baseEach(collection, function(value, index, collection) { | ||
var current = +iteratee(value, index, collection); | ||
if (comparator(current, computed) || (current === exValue && current === result)) { | ||
computed = current; | ||
result = value; | ||
while (++index < length) { | ||
var value = array[index], | ||
current = iteratee(value); | ||
if (current != null && (computed === undefined | ||
? current === current | ||
: comparator(current, computed) | ||
)) { | ||
var computed = current, | ||
result = value; | ||
} | ||
}); | ||
} | ||
return result; | ||
@@ -27,0 +28,0 @@ } |
@@ -0,1 +1,4 @@ | ||
var toInteger = require('../toInteger'), | ||
toLength = require('../toLength'); | ||
/** | ||
@@ -14,14 +17,12 @@ * The base implementation of `_.fill` without an iteratee call guard. | ||
start = start == null ? 0 : (+start || 0); | ||
start = toInteger(start); | ||
if (start < 0) { | ||
start = -start > length ? 0 : (length + start); | ||
} | ||
end = (end === undefined || end > length) ? length : (+end || 0); | ||
end = (end === undefined || end > length) ? length : toInteger(end); | ||
if (end < 0) { | ||
end += length; | ||
} | ||
length = start > end ? 0 : (end >>> 0); | ||
start >>>= 0; | ||
while (start < length) { | ||
end = start > end ? 0 : toLength(end); | ||
while (start < end) { | ||
array[start++] = value; | ||
@@ -28,0 +29,0 @@ } |
var baseEach = require('./baseEach'); | ||
/** | ||
* The base implementation of `_.filter` without support for callback | ||
* shorthands and `this` binding. | ||
* The base implementation of `_.filter` without support for iteratee shorthands. | ||
* | ||
* @private | ||
* @param {Array|Object|string} collection The collection to iterate over. | ||
* @param {Array|Object} collection The collection to iterate over. | ||
* @param {Function} predicate The function invoked per iteration. | ||
@@ -10,0 +9,0 @@ * @returns {Array} Returns the new filtered array. |
/** | ||
* The base implementation of `_.find`, `_.findLast`, `_.findKey`, and `_.findLastKey`, | ||
* without support for callback shorthands and `this` binding, which iterates | ||
* over `collection` using the provided `eachFunc`. | ||
* The base implementation of methods like `_.find` and `_.findKey`, without | ||
* support for iteratee shorthands, which iterates over `collection` using | ||
* the provided `eachFunc`. | ||
* | ||
* @private | ||
* @param {Array|Object|string} collection The collection to search. | ||
* @param {Array|Object} collection The collection to search. | ||
* @param {Function} predicate The function invoked per iteration. | ||
* @param {Function} eachFunc The function to iterate over `collection`. | ||
* @param {boolean} [retKey] Specify returning the key of the found element | ||
* instead of the element itself. | ||
* @param {boolean} [retKey] Specify returning the key of the found element instead of the element itself. | ||
* @returns {*} Returns the found element or its key, else `undefined`. | ||
@@ -13,0 +12,0 @@ */ |
/** | ||
* The base implementation of `_.findIndex` and `_.findLastIndex` without | ||
* support for callback shorthands and `this` binding. | ||
* support for iteratee shorthands. | ||
* | ||
@@ -5,0 +5,0 @@ * @private |
var arrayPush = require('./arrayPush'), | ||
isArguments = require('../lang/isArguments'), | ||
isArray = require('../lang/isArray'), | ||
isArrayLike = require('./isArrayLike'), | ||
isObjectLike = require('./isObjectLike'); | ||
isArguments = require('../isArguments'), | ||
isArray = require('../isArray'), | ||
isArrayLikeObject = require('../isArrayLikeObject'); | ||
/** | ||
* The base implementation of `_.flatten` with added support for restricting | ||
* flattening and specifying the start index. | ||
* The base implementation of `_.flatten` with support for restricting flattening. | ||
* | ||
@@ -26,3 +24,3 @@ * @private | ||
var value = array[index]; | ||
if (isObjectLike(value) && isArrayLike(value) && | ||
if (isArrayLikeObject(value) && | ||
(isStrict || isArray(value) || isArguments(value))) { | ||
@@ -29,0 +27,0 @@ if (isDeep) { |
var baseFor = require('./baseFor'), | ||
keysIn = require('../object/keysIn'); | ||
keysIn = require('../keysIn'); | ||
/** | ||
* The base implementation of `_.forIn` without support for callback | ||
* shorthands and `this` binding. | ||
* The base implementation of `_.forIn` without support for iteratee shorthands. | ||
* | ||
@@ -14,5 +13,5 @@ * @private | ||
function baseForIn(object, iteratee) { | ||
return baseFor(object, iteratee, keysIn); | ||
return object == null ? object : baseFor(object, iteratee, keysIn); | ||
} | ||
module.exports = baseForIn; |
var baseFor = require('./baseFor'), | ||
keys = require('../object/keys'); | ||
keys = require('../keys'); | ||
/** | ||
* The base implementation of `_.forOwn` without support for callback | ||
* shorthands and `this` binding. | ||
* The base implementation of `_.forOwn` without support for iteratee shorthands. | ||
* | ||
@@ -14,5 +13,5 @@ * @private | ||
function baseForOwn(object, iteratee) { | ||
return baseFor(object, iteratee, keys); | ||
return object && baseFor(object, iteratee, keys); | ||
} | ||
module.exports = baseForOwn; |
var baseForRight = require('./baseForRight'), | ||
keys = require('../object/keys'); | ||
keys = require('../keys'); | ||
/** | ||
* The base implementation of `_.forOwnRight` without support for callback | ||
* shorthands and `this` binding. | ||
* The base implementation of `_.forOwnRight` without support for iteratee shorthands. | ||
* | ||
@@ -14,5 +13,5 @@ * @private | ||
function baseForOwnRight(object, iteratee) { | ||
return baseForRight(object, iteratee, keys); | ||
return object && baseForRight(object, iteratee, keys); | ||
} | ||
module.exports = baseForOwnRight; |
@@ -1,2 +0,3 @@ | ||
var isFunction = require('../lang/isFunction'); | ||
var arrayFilter = require('./arrayFilter'), | ||
isFunction = require('../isFunction'); | ||
@@ -13,16 +14,7 @@ /** | ||
function baseFunctions(object, props) { | ||
var index = -1, | ||
length = props.length, | ||
resIndex = -1, | ||
result = []; | ||
while (++index < length) { | ||
var key = props[index]; | ||
if (isFunction(object[key])) { | ||
result[++resIndex] = key; | ||
} | ||
} | ||
return result; | ||
return arrayFilter(props, function(key) { | ||
return isFunction(object[key]); | ||
}); | ||
} | ||
module.exports = baseFunctions; |
@@ -1,20 +0,15 @@ | ||
var toObject = require('./toObject'); | ||
var baseToPath = require('./baseToPath'), | ||
isKey = require('./isKey'); | ||
/** | ||
* The base implementation of `get` without support for string paths | ||
* and default values. | ||
* The base implementation of `_.get` without support for default values. | ||
* | ||
* @private | ||
* @param {Object} object The object to query. | ||
* @param {Array} path The path of the property to get. | ||
* @param {string} [pathKey] The key representation of path. | ||
* @param {Array|string} path The path of the property to get. | ||
* @returns {*} Returns the resolved value. | ||
*/ | ||
function baseGet(object, path, pathKey) { | ||
if (object == null) { | ||
return; | ||
} | ||
if (pathKey !== undefined && pathKey in toObject(object)) { | ||
path = [pathKey]; | ||
} | ||
function baseGet(object, path) { | ||
path = isKey(path, object) ? [path + ''] : baseToPath(path); | ||
var index = 0, | ||
@@ -21,0 +16,0 @@ length = path.length; |
var indexOfNaN = require('./indexOfNaN'); | ||
/** | ||
* The base implementation of `_.indexOf` without support for binary searches. | ||
* The base implementation of `_.indexOf` without `fromIndex` bounds checks. | ||
* | ||
@@ -6,0 +6,0 @@ * @private |
var baseIsEqualDeep = require('./baseIsEqualDeep'), | ||
isObject = require('../lang/isObject'), | ||
isObjectLike = require('./isObjectLike'); | ||
isObject = require('../isObject'), | ||
isObjectLike = require('../isObjectLike'); | ||
/** | ||
* The base implementation of `_.isEqual` without support for `this` binding | ||
* `customizer` functions. | ||
* The base implementation of `_.isEqual` which supports partial comparisons | ||
* and tracks traversed objects. | ||
* | ||
@@ -12,9 +12,11 @@ * @private | ||
* @param {*} other The other value to compare. | ||
* @param {Function} [customizer] The function to customize comparing values. | ||
* @param {boolean} [isLoose] Specify performing partial comparisons. | ||
* @param {Array} [stackA] Tracks traversed `value` objects. | ||
* @param {Array} [stackB] Tracks traversed `other` objects. | ||
* @param {Function} [customizer] The function to customize comparisons. | ||
* @param {boolean} [bitmask] The bitmask of comparison flags. | ||
* The bitmask may be composed of the following flags: | ||
* 1 - Unordered comparison | ||
* 2 - Partial comparison | ||
* @param {Object} [stack] Tracks traversed `value` and `other` objects. | ||
* @returns {boolean} Returns `true` if the values are equivalent, else `false`. | ||
*/ | ||
function baseIsEqual(value, other, customizer, isLoose, stackA, stackB) { | ||
function baseIsEqual(value, other, customizer, bitmask, stack) { | ||
if (value === other) { | ||
@@ -26,5 +28,5 @@ return true; | ||
} | ||
return baseIsEqualDeep(value, other, baseIsEqual, customizer, isLoose, stackA, stackB); | ||
return baseIsEqualDeep(value, other, baseIsEqual, customizer, bitmask, stack); | ||
} | ||
module.exports = baseIsEqual; |
@@ -1,7 +0,13 @@ | ||
var equalArrays = require('./equalArrays'), | ||
var Stack = require('./Stack'), | ||
equalArrays = require('./equalArrays'), | ||
equalByTag = require('./equalByTag'), | ||
equalObjects = require('./equalObjects'), | ||
isArray = require('../lang/isArray'), | ||
isTypedArray = require('../lang/isTypedArray'); | ||
getTag = require('./getTag'), | ||
isArray = require('../isArray'), | ||
isHostObject = require('./isHostObject'), | ||
isTypedArray = require('../isTypedArray'); | ||
/** Used to compose bitmasks for comparison styles. */ | ||
var PARTIAL_COMPARE_FLAG = 2; | ||
/** `Object#toString` result references. */ | ||
@@ -12,4 +18,4 @@ var argsTag = '[object Arguments]', | ||
/** Used for native method references. */ | ||
var objectProto = Object.prototype; | ||
/** Used for built-in method references. */ | ||
var objectProto = global.Object.prototype; | ||
@@ -20,8 +26,2 @@ /** Used to check objects for own properties. */ | ||
/** | ||
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) | ||
* of values. | ||
*/ | ||
var objToString = objectProto.toString; | ||
/** | ||
* A specialized version of `baseIsEqual` for arrays and objects which performs | ||
@@ -35,9 +35,8 @@ * deep comparisons and tracks traversed objects enabling objects with circular | ||
* @param {Function} equalFunc The function to determine equivalents of values. | ||
* @param {Function} [customizer] The function to customize comparing objects. | ||
* @param {boolean} [isLoose] Specify performing partial comparisons. | ||
* @param {Array} [stackA=[]] Tracks traversed `value` objects. | ||
* @param {Array} [stackB=[]] Tracks traversed `other` objects. | ||
* @param {Function} [customizer] The function to customize comparisons. | ||
* @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual` for more details. | ||
* @param {Object} [stack] Tracks traversed `object` and `other` objects. | ||
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`. | ||
*/ | ||
function baseIsEqualDeep(object, other, equalFunc, customizer, isLoose, stackA, stackB) { | ||
function baseIsEqualDeep(object, other, equalFunc, customizer, bitmask, stack) { | ||
var objIsArr = isArray(object), | ||
@@ -49,3 +48,3 @@ othIsArr = isArray(other), | ||
if (!objIsArr) { | ||
objTag = objToString.call(object); | ||
objTag = getTag(object); | ||
if (objTag == argsTag) { | ||
@@ -58,3 +57,3 @@ objTag = objectTag; | ||
if (!othIsArr) { | ||
othTag = objToString.call(other); | ||
othTag = getTag(other); | ||
if (othTag == argsTag) { | ||
@@ -66,10 +65,11 @@ othTag = objectTag; | ||
} | ||
var objIsObj = objTag == objectTag, | ||
othIsObj = othTag == objectTag, | ||
var objIsObj = objTag == objectTag && !isHostObject(object), | ||
othIsObj = othTag == objectTag && !isHostObject(other), | ||
isSameTag = objTag == othTag; | ||
if (isSameTag && !(objIsArr || objIsObj)) { | ||
return equalByTag(object, other, objTag); | ||
return equalByTag(object, other, objTag, equalFunc, customizer, bitmask); | ||
} | ||
if (!isLoose) { | ||
var isPartial = bitmask & PARTIAL_COMPARE_FLAG; | ||
if (!isPartial) { | ||
var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), | ||
@@ -79,3 +79,3 @@ othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); | ||
if (objIsWrapped || othIsWrapped) { | ||
return equalFunc(objIsWrapped ? object.value() : object, othIsWrapped ? other.value() : other, customizer, isLoose, stackA, stackB); | ||
return equalFunc(objIsWrapped ? object.value() : object, othIsWrapped ? other.value() : other, customizer, bitmask, stack); | ||
} | ||
@@ -86,25 +86,6 @@ } | ||
} | ||
// Assume cyclic values are equal. | ||
// For more information on detecting circular references see https://es5.github.io/#JO. | ||
stackA || (stackA = []); | ||
stackB || (stackB = []); | ||
var length = stackA.length; | ||
while (length--) { | ||
if (stackA[length] == object) { | ||
return stackB[length] == other; | ||
} | ||
} | ||
// Add `object` and `other` to the stack of traversed objects. | ||
stackA.push(object); | ||
stackB.push(other); | ||
var result = (objIsArr ? equalArrays : equalObjects)(object, other, equalFunc, customizer, isLoose, stackA, stackB); | ||
stackA.pop(); | ||
stackB.pop(); | ||
return result; | ||
stack || (stack = new Stack); | ||
return (objIsArr ? equalArrays : equalObjects)(object, other, equalFunc, customizer, bitmask, stack); | ||
} | ||
module.exports = baseIsEqualDeep; |
@@ -1,15 +0,19 @@ | ||
var baseIsEqual = require('./baseIsEqual'), | ||
toObject = require('./toObject'); | ||
var Stack = require('./Stack'), | ||
baseIsEqual = require('./baseIsEqual'); | ||
/** Used to compose bitmasks for comparison styles. */ | ||
var UNORDERED_COMPARE_FLAG = 1, | ||
PARTIAL_COMPARE_FLAG = 2; | ||
/** | ||
* The base implementation of `_.isMatch` without support for callback | ||
* shorthands and `this` binding. | ||
* The base implementation of `_.isMatch` without support for iteratee shorthands. | ||
* | ||
* @private | ||
* @param {Object} object The object to inspect. | ||
* @param {Array} matchData The propery names, values, and compare flags to match. | ||
* @param {Function} [customizer] The function to customize comparing objects. | ||
* @param {Object} source The object of property values to match. | ||
* @param {Array} matchData The property names, values, and compare flags to match. | ||
* @param {Function} [customizer] The function to customize comparisons. | ||
* @returns {boolean} Returns `true` if `object` is a match, else `false`. | ||
*/ | ||
function baseIsMatch(object, matchData, customizer) { | ||
function baseIsMatch(object, source, matchData, customizer) { | ||
var index = matchData.length, | ||
@@ -22,3 +26,3 @@ length = index, | ||
} | ||
object = toObject(object); | ||
object = Object(object); | ||
while (index--) { | ||
@@ -44,4 +48,6 @@ var data = matchData[index]; | ||
} else { | ||
var result = customizer ? customizer(objValue, srcValue, key) : undefined; | ||
if (!(result === undefined ? baseIsEqual(srcValue, objValue, customizer, true) : result)) { | ||
var stack = new Stack, | ||
result = customizer ? customizer(objValue, srcValue, key, object, source, stack) : undefined; | ||
if (!(result === undefined ? baseIsEqual(srcValue, objValue, customizer, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG, stack) : result)) { | ||
return false; | ||
@@ -48,0 +54,0 @@ } |
var baseEach = require('./baseEach'), | ||
isArrayLike = require('./isArrayLike'); | ||
isArrayLike = require('../isArrayLike'); | ||
/** | ||
* The base implementation of `_.map` without support for callback shorthands | ||
* and `this` binding. | ||
* The base implementation of `_.map` without support for iteratee shorthands. | ||
* | ||
* @private | ||
* @param {Array|Object|string} collection The collection to iterate over. | ||
* @param {Array|Object} collection The collection to iterate over. | ||
* @param {Function} iteratee The function invoked per iteration. | ||
@@ -11,0 +10,0 @@ * @returns {Array} Returns the new mapped array. |
var baseIsMatch = require('./baseIsMatch'), | ||
getMatchData = require('./getMatchData'), | ||
toObject = require('./toObject'); | ||
getMatchData = require('./getMatchData'); | ||
/** | ||
* The base implementation of `_.matches` which does not clone `source`. | ||
* The base implementation of `_.matches` which doesn't clone `source`. | ||
* | ||
@@ -22,7 +21,8 @@ * @private | ||
} | ||
return object[key] === value && (value !== undefined || (key in toObject(object))); | ||
return object[key] === value && | ||
(value !== undefined || (key in Object(object))); | ||
}; | ||
} | ||
return function(object) { | ||
return baseIsMatch(object, matchData); | ||
return object === source || baseIsMatch(object, source, matchData); | ||
}; | ||
@@ -29,0 +29,0 @@ } |
@@ -1,42 +0,23 @@ | ||
var baseGet = require('./baseGet'), | ||
baseIsEqual = require('./baseIsEqual'), | ||
baseSlice = require('./baseSlice'), | ||
isArray = require('../lang/isArray'), | ||
isKey = require('./isKey'), | ||
isStrictComparable = require('./isStrictComparable'), | ||
last = require('../array/last'), | ||
toObject = require('./toObject'), | ||
toPath = require('./toPath'); | ||
var baseIsEqual = require('./baseIsEqual'), | ||
get = require('../get'), | ||
hasIn = require('../hasIn'); | ||
/** Used to compose bitmasks for comparison styles. */ | ||
var UNORDERED_COMPARE_FLAG = 1, | ||
PARTIAL_COMPARE_FLAG = 2; | ||
/** | ||
* The base implementation of `_.matchesProperty` which does not clone `srcValue`. | ||
* The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. | ||
* | ||
* @private | ||
* @param {string} path The path of the property to get. | ||
* @param {*} srcValue The value to compare. | ||
* @param {*} srcValue The value to match. | ||
* @returns {Function} Returns the new function. | ||
*/ | ||
function baseMatchesProperty(path, srcValue) { | ||
var isArr = isArray(path), | ||
isCommon = isKey(path) && isStrictComparable(srcValue), | ||
pathKey = (path + ''); | ||
path = toPath(path); | ||
return function(object) { | ||
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] === srcValue | ||
? (srcValue !== undefined || (key in object)) | ||
: baseIsEqual(srcValue, object[key], undefined, true); | ||
var objValue = get(object, path); | ||
return (objValue === undefined && objValue === srcValue) | ||
? hasIn(object, path) | ||
: baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG); | ||
}; | ||
@@ -43,0 +24,0 @@ } |
@@ -1,13 +0,12 @@ | ||
var arrayEach = require('./arrayEach'), | ||
var Stack = require('./Stack'), | ||
arrayEach = require('./arrayEach'), | ||
assignMergeValue = require('./assignMergeValue'), | ||
baseMergeDeep = require('./baseMergeDeep'), | ||
isArray = require('../lang/isArray'), | ||
isArrayLike = require('./isArrayLike'), | ||
isObject = require('../lang/isObject'), | ||
isObjectLike = require('./isObjectLike'), | ||
isTypedArray = require('../lang/isTypedArray'), | ||
keys = require('../object/keys'); | ||
isArray = require('../isArray'), | ||
isObject = require('../isObject'), | ||
isTypedArray = require('../isTypedArray'), | ||
keysIn = require('../keysIn'); | ||
/** | ||
* The base implementation of `_.merge` without support for argument juggling, | ||
* multiple sources, and `this` binding `customizer` functions. | ||
* The base implementation of `_.merge` without support for multiple sources. | ||
* | ||
@@ -18,13 +17,9 @@ * @private | ||
* @param {Function} [customizer] The function to customize merged values. | ||
* @param {Array} [stackA=[]] Tracks traversed source objects. | ||
* @param {Array} [stackB=[]] Associates values with source counterparts. | ||
* @returns {Object} Returns `object`. | ||
* @param {Object} [stack] Tracks traversed source values and their merged counterparts. | ||
*/ | ||
function baseMerge(object, source, customizer, stackA, stackB) { | ||
if (!isObject(object)) { | ||
return object; | ||
function baseMerge(object, source, customizer, stack) { | ||
if (object === source) { | ||
return; | ||
} | ||
var isSrcArr = isArrayLike(source) && (isArray(source) || isTypedArray(source)), | ||
props = isSrcArr ? undefined : keys(source); | ||
var props = (isArray(source) || isTypedArray(source)) ? undefined : keysIn(source); | ||
arrayEach(props || source, function(srcValue, key) { | ||
@@ -35,24 +30,16 @@ if (props) { | ||
} | ||
if (isObjectLike(srcValue)) { | ||
stackA || (stackA = []); | ||
stackB || (stackB = []); | ||
baseMergeDeep(object, source, key, baseMerge, customizer, stackA, stackB); | ||
if (isObject(srcValue)) { | ||
stack || (stack = new Stack); | ||
baseMergeDeep(object, source, key, baseMerge, customizer, stack); | ||
} | ||
else { | ||
var value = object[key], | ||
result = customizer ? customizer(value, srcValue, key, object, source) : undefined, | ||
isCommon = result === undefined; | ||
if (isCommon) { | ||
result = srcValue; | ||
var newValue = customizer ? customizer(object[key], srcValue, (key + ''), object, source, stack) : undefined; | ||
if (newValue === undefined) { | ||
newValue = srcValue; | ||
} | ||
if ((result !== undefined || (isSrcArr && !(key in object))) && | ||
(isCommon || (result === result ? (result !== value) : (value === value)))) { | ||
object[key] = result; | ||
} | ||
assignMergeValue(object, key, newValue); | ||
} | ||
}); | ||
return object; | ||
} | ||
module.exports = baseMerge; |
@@ -1,8 +0,12 @@ | ||
var arrayCopy = require('./arrayCopy'), | ||
isArguments = require('../lang/isArguments'), | ||
isArray = require('../lang/isArray'), | ||
isArrayLike = require('./isArrayLike'), | ||
isPlainObject = require('../lang/isPlainObject'), | ||
isTypedArray = require('../lang/isTypedArray'), | ||
toPlainObject = require('../lang/toPlainObject'); | ||
var assignMergeValue = require('./assignMergeValue'), | ||
baseClone = require('./baseClone'), | ||
copyArray = require('./copyArray'), | ||
isArguments = require('../isArguments'), | ||
isArray = require('../isArray'), | ||
isArrayLikeObject = require('../isArrayLikeObject'), | ||
isFunction = require('../isFunction'), | ||
isObject = require('../isObject'), | ||
isPlainObject = require('../isPlainObject'), | ||
isTypedArray = require('../isTypedArray'), | ||
toPlainObject = require('../toPlainObject'); | ||
@@ -19,50 +23,42 @@ /** | ||
* @param {Function} mergeFunc The function to merge values. | ||
* @param {Function} [customizer] The function to customize merged values. | ||
* @param {Array} [stackA=[]] Tracks traversed source objects. | ||
* @param {Array} [stackB=[]] Associates values with source counterparts. | ||
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`. | ||
* @param {Function} [customizer] The function to customize assigned values. | ||
* @param {Object} [stack] Tracks traversed source values and their merged counterparts. | ||
*/ | ||
function baseMergeDeep(object, source, key, mergeFunc, customizer, stackA, stackB) { | ||
var length = stackA.length, | ||
srcValue = source[key]; | ||
function baseMergeDeep(object, source, key, mergeFunc, customizer, stack) { | ||
var objValue = object[key], | ||
srcValue = source[key], | ||
stacked = stack.get(srcValue) || stack.get(objValue); | ||
while (length--) { | ||
if (stackA[length] == srcValue) { | ||
object[key] = stackB[length]; | ||
return; | ||
} | ||
if (stacked) { | ||
assignMergeValue(object, key, stacked); | ||
return; | ||
} | ||
var value = object[key], | ||
result = customizer ? customizer(value, srcValue, key, object, source) : undefined, | ||
isCommon = result === undefined; | ||
var newValue = customizer ? customizer(objValue, srcValue, (key + ''), object, source, stack) : undefined, | ||
isCommon = newValue === undefined; | ||
if (isCommon) { | ||
result = srcValue; | ||
if (isArrayLike(srcValue) && (isArray(srcValue) || isTypedArray(srcValue))) { | ||
result = isArray(value) | ||
? value | ||
: (isArrayLike(value) ? arrayCopy(value) : []); | ||
newValue = srcValue; | ||
if (isArray(srcValue) || isTypedArray(srcValue)) { | ||
newValue = isArray(objValue) | ||
? objValue | ||
: ((isArrayLikeObject(objValue)) ? copyArray(objValue) : baseClone(srcValue)); | ||
} | ||
else if (isPlainObject(srcValue) || isArguments(srcValue)) { | ||
result = isArguments(value) | ||
? toPlainObject(value) | ||
: (isPlainObject(value) ? value : {}); | ||
newValue = isArguments(objValue) | ||
? toPlainObject(objValue) | ||
: (isObject(objValue) ? objValue : baseClone(srcValue)); | ||
} | ||
else { | ||
isCommon = false; | ||
isCommon = isFunction(srcValue); | ||
} | ||
} | ||
// Add the source value to the stack of traversed objects and associate | ||
// it with its merged value. | ||
stackA.push(srcValue); | ||
stackB.push(result); | ||
stack.set(srcValue, newValue); | ||
if (isCommon) { | ||
// Recursively merge objects and arrays (susceptible to call stack limits). | ||
object[key] = mergeFunc(result, srcValue, customizer, stackA, stackB); | ||
} else if (result === result ? (result !== value) : (value === value)) { | ||
object[key] = result; | ||
mergeFunc(newValue, srcValue, customizer, stack); | ||
} | ||
assignMergeValue(object, key, newValue); | ||
} | ||
module.exports = baseMergeDeep; |
@@ -1,3 +0,2 @@ | ||
var baseGet = require('./baseGet'), | ||
toPath = require('./toPath'); | ||
var baseGet = require('./baseGet'); | ||
@@ -12,6 +11,4 @@ /** | ||
function basePropertyDeep(path) { | ||
var pathKey = (path + ''); | ||
path = toPath(path); | ||
return function(object) { | ||
return baseGet(object, path, pathKey); | ||
return baseGet(object, path); | ||
}; | ||
@@ -18,0 +15,0 @@ } |
@@ -1,7 +0,11 @@ | ||
var isIndex = require('./isIndex'); | ||
var baseToPath = require('./baseToPath'), | ||
isIndex = require('./isIndex'), | ||
isKey = require('./isKey'), | ||
last = require('../last'), | ||
parent = require('./parent'); | ||
/** Used for native method references. */ | ||
var arrayProto = Array.prototype; | ||
/** Used for built-in method references. */ | ||
var arrayProto = global.Array.prototype; | ||
/** Native method references. */ | ||
/** Built-in value references. */ | ||
var splice = arrayProto.splice; | ||
@@ -11,3 +15,3 @@ | ||
* The base implementation of `_.pullAt` without support for individual | ||
* index arguments and capturing the removed elements. | ||
* indexes or capturing the removed elements. | ||
* | ||
@@ -20,8 +24,23 @@ * @private | ||
function basePullAt(array, indexes) { | ||
var length = array ? indexes.length : 0; | ||
var length = array ? indexes.length : 0, | ||
lastIndex = length - 1; | ||
while (length--) { | ||
var index = indexes[length]; | ||
if (index != previous && isIndex(index)) { | ||
if (lastIndex == length || index != previous) { | ||
var previous = index; | ||
splice.call(array, index, 1); | ||
if (isIndex(index)) { | ||
splice.call(array, index, 1); | ||
} | ||
else if (!isKey(index, array)) { | ||
var path = baseToPath(index), | ||
object = parent(array, path); | ||
if (object != null) { | ||
delete object[last(path)]; | ||
} | ||
} | ||
else { | ||
delete array[index]; | ||
} | ||
} | ||
@@ -28,0 +47,0 @@ } |
@@ -1,2 +0,2 @@ | ||
/* Native method references for those with the same name as other `lodash` methods. */ | ||
/* Built-in method references for those with the same name as other `lodash` methods. */ | ||
var nativeFloor = Math.floor, | ||
@@ -6,14 +6,14 @@ nativeRandom = Math.random; | ||
/** | ||
* The base implementation of `_.random` without support for argument juggling | ||
* and returning floating-point numbers. | ||
* The base implementation of `_.random` without support for returning | ||
* floating-point numbers. | ||
* | ||
* @private | ||
* @param {number} min The minimum possible value. | ||
* @param {number} max The maximum possible value. | ||
* @param {number} lower The lower bound. | ||
* @param {number} upper The upper bound. | ||
* @returns {number} Returns the random number. | ||
*/ | ||
function baseRandom(min, max) { | ||
return min + nativeFloor(nativeRandom() * (max - min + 1)); | ||
function baseRandom(lower, upper) { | ||
return lower + nativeFloor(nativeRandom() * (upper - lower + 1)); | ||
} | ||
module.exports = baseRandom; |
/** | ||
* The base implementation of `_.reduce` and `_.reduceRight` without support | ||
* for callback shorthands and `this` binding, which iterates over `collection` | ||
* using the provided `eachFunc`. | ||
* The base implementation of `_.reduce` and `_.reduceRight`, without support | ||
* for iteratee shorthands, which iterates over `collection` using the provided | ||
* `eachFunc`. | ||
* | ||
* @private | ||
* @param {Array|Object|string} collection The collection to iterate over. | ||
* @param {Array|Object} collection The collection to iterate over. | ||
* @param {Function} iteratee The function invoked per iteration. | ||
* @param {*} accumulator The initial value. | ||
* @param {boolean} initFromCollection Specify using the first or last element | ||
* of `collection` as the initial value. | ||
* @param {boolean} initFromCollection Specify using the first or last element of `collection` as the initial value. | ||
* @param {Function} eachFunc The function to iterate over `collection`. | ||
@@ -13,0 +12,0 @@ * @returns {*} Returns the accumulated value. |
@@ -1,2 +0,2 @@ | ||
var identity = require('../utility/identity'), | ||
var identity = require('../identity'), | ||
metaMap = require('./metaMap'); | ||
@@ -3,0 +3,0 @@ |
@@ -14,7 +14,6 @@ /** | ||
start = start == null ? 0 : (+start || 0); | ||
if (start < 0) { | ||
start = -start > length ? 0 : (length + start); | ||
} | ||
end = (end === undefined || end > length) ? length : (+end || 0); | ||
end = end > length ? length : end; | ||
if (end < 0) { | ||
@@ -21,0 +20,0 @@ end += length; |
var baseEach = require('./baseEach'); | ||
/** | ||
* The base implementation of `_.some` without support for callback shorthands | ||
* and `this` binding. | ||
* The base implementation of `_.some` without support for iteratee shorthands. | ||
* | ||
* @private | ||
* @param {Array|Object|string} collection The collection to iterate over. | ||
* @param {Array|Object} collection The collection to iterate over. | ||
* @param {Function} predicate The function invoked per iteration. | ||
* @returns {boolean} Returns `true` if any element passes the predicate check, | ||
* else `false`. | ||
* @returns {boolean} Returns `true` if any element passes the predicate check, else `false`. | ||
*/ | ||
@@ -13,0 +11,0 @@ function baseSome(collection, predicate) { |
@@ -1,17 +0,20 @@ | ||
var baseEach = require('./baseEach'); | ||
/** | ||
* The base implementation of `_.sum` without support for callback shorthands | ||
* and `this` binding. | ||
* The base implementation of `_.sum` without support for iteratee shorthands. | ||
* | ||
* @private | ||
* @param {Array|Object|string} collection The collection to iterate over. | ||
* @param {Array} array The array to iterate over. | ||
* @param {Function} iteratee The function invoked per iteration. | ||
* @returns {number} Returns the sum. | ||
*/ | ||
function baseSum(collection, iteratee) { | ||
var result = 0; | ||
baseEach(collection, function(value, index, collection) { | ||
result += +iteratee(value, index, collection) || 0; | ||
}); | ||
function baseSum(array, iteratee) { | ||
var result, | ||
index = -1, | ||
length = array.length; | ||
while (++index < length) { | ||
var current = iteratee(array[index]); | ||
if (current !== undefined) { | ||
result = result === undefined ? current : (result + current); | ||
} | ||
} | ||
return result; | ||
@@ -18,0 +21,0 @@ } |
@@ -1,4 +0,7 @@ | ||
var baseIndexOf = require('./baseIndexOf'), | ||
cacheIndexOf = require('./cacheIndexOf'), | ||
createCache = require('./createCache'); | ||
var SetCache = require('./SetCache'), | ||
arrayIncludes = require('./arrayIncludes'), | ||
arrayIncludesWith = require('./arrayIncludesWith'), | ||
cacheHas = require('./cacheHas'), | ||
createSet = require('./createSet'), | ||
setToArray = require('./setToArray'); | ||
@@ -9,24 +12,32 @@ /** Used as the size to enable large array optimizations. */ | ||
/** | ||
* The base implementation of `_.uniq` without support for callback shorthands | ||
* and `this` binding. | ||
* The base implementation of `_.uniqBy` without support for iteratee shorthands. | ||
* | ||
* @private | ||
* @param {Array} array The array to inspect. | ||
* @param {Function} [iteratee] The function invoked per iteration. | ||
* @param {Function} [iteratee] The iteratee invoked per element. | ||
* @param {Function} [comparator] The comparator invoked per element. | ||
* @returns {Array} Returns the new duplicate free array. | ||
*/ | ||
function baseUniq(array, iteratee) { | ||
function baseUniq(array, iteratee, comparator) { | ||
var index = -1, | ||
indexOf = baseIndexOf, | ||
includes = arrayIncludes, | ||
length = array.length, | ||
isCommon = true, | ||
isLarge = isCommon && length >= LARGE_ARRAY_SIZE, | ||
seen = isLarge ? createCache() : null, | ||
result = []; | ||
result = [], | ||
seen = result; | ||
if (seen) { | ||
indexOf = cacheIndexOf; | ||
if (comparator) { | ||
isCommon = false; | ||
} else { | ||
isLarge = false; | ||
includes = arrayIncludesWith; | ||
} | ||
else if (length >= LARGE_ARRAY_SIZE) { | ||
var set = iteratee ? null : createSet(array); | ||
if (set) { | ||
return setToArray(set); | ||
} | ||
isCommon = false; | ||
includes = cacheHas; | ||
seen = new SetCache; | ||
} | ||
else { | ||
seen = iteratee ? [] : result; | ||
@@ -37,5 +48,5 @@ } | ||
var value = array[index], | ||
computed = iteratee ? iteratee(value, index, array) : value; | ||
computed = iteratee ? iteratee(value) : value; | ||
if (isCommon && value === value) { | ||
if (isCommon && computed === computed) { | ||
var seenIndex = seen.length; | ||
@@ -52,4 +63,4 @@ while (seenIndex--) { | ||
} | ||
else if (indexOf(seen, computed, 0) < 0) { | ||
if (iteratee || isLarge) { | ||
else if (!includes(seen, computed, comparator)) { | ||
if (seen !== result) { | ||
seen.push(computed); | ||
@@ -56,0 +67,0 @@ } |
@@ -0,1 +1,3 @@ | ||
var arrayMap = require('./arrayMap'); | ||
/** | ||
@@ -12,12 +14,7 @@ * The base implementation of `_.values` and `_.valuesIn` which creates an | ||
function baseValues(object, props) { | ||
var index = -1, | ||
length = props.length, | ||
result = Array(length); | ||
while (++index < length) { | ||
result[index] = object[props[index]]; | ||
} | ||
return result; | ||
return arrayMap(props, function(key) { | ||
return object[key]; | ||
}); | ||
} | ||
module.exports = baseValues; |
var baseSlice = require('./baseSlice'); | ||
/** | ||
* The base implementation of `_.dropRightWhile`, `_.dropWhile`, `_.takeRightWhile`, | ||
* and `_.takeWhile` without support for callback shorthands and `this` binding. | ||
* The base implementation of methods like `_.dropWhile` and `_.takeWhile` | ||
* without support for iteratee shorthands. | ||
* | ||
@@ -18,3 +18,5 @@ * @private | ||
while ((fromRight ? index-- : ++index < length) && predicate(array[index], index, array)) {} | ||
while ((fromRight ? index-- : ++index < length) && | ||
predicate(array[index], index, array)) {} | ||
return isDrop | ||
@@ -21,0 +23,0 @@ ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length)) |
var LazyWrapper = require('./LazyWrapper'), | ||
arrayPush = require('./arrayPush'); | ||
arrayPush = require('./arrayPush'), | ||
arrayReduce = require('./arrayReduce'); | ||
@@ -11,3 +12,3 @@ /** | ||
* @param {*} value The unwrapped value. | ||
* @param {Array} actions Actions to peform to resolve the unwrapped value. | ||
* @param {Array} actions Actions to perform to resolve the unwrapped value. | ||
* @returns {*} Returns the resolved value. | ||
@@ -20,12 +21,7 @@ */ | ||
} | ||
var index = -1, | ||
length = actions.length; | ||
while (++index < length) { | ||
var action = actions[index]; | ||
result = action.func.apply(action.thisArg, arrayPush([result], action.args)); | ||
} | ||
return result; | ||
return arrayReduce(actions, function(result, action) { | ||
return action.func.apply(action.thisArg, arrayPush([result], action.args)); | ||
}, result); | ||
} | ||
module.exports = baseWrapperValue; |
@@ -1,5 +0,8 @@ | ||
var isObject = require('../lang/isObject'); | ||
var isKeyable = require('./isKeyable'); | ||
/** Used to stand-in for `undefined` hash values. */ | ||
var HASH_UNDEFINED = '__lodash_hash_undefined__'; | ||
/** | ||
* Adds `value` to the cache. | ||
* Adds `value` to the set cache. | ||
* | ||
@@ -12,10 +15,14 @@ * @private | ||
function cachePush(value) { | ||
var data = this.data; | ||
if (typeof value == 'string' || isObject(value)) { | ||
data.set.add(value); | ||
} else { | ||
data.hash[value] = true; | ||
var map = this.__data__; | ||
if (isKeyable(value)) { | ||
var data = map.__data__, | ||
hash = typeof value == 'string' ? data.string : data.hash; | ||
hash[value] = HASH_UNDEFINED; | ||
} | ||
else { | ||
map.set(value, HASH_UNDEFINED); | ||
} | ||
} | ||
module.exports = cachePush; |
@@ -1,16 +0,33 @@ | ||
var baseCompareAscending = require('./baseCompareAscending'); | ||
/** | ||
* Used by `_.sortBy` to compare transformed elements of a collection and stable | ||
* sort them in ascending order. | ||
* Compares values to sort them in ascending order. | ||
* | ||
* @private | ||
* @param {Object} object The object to compare. | ||
* @param {Object} other The other object to compare. | ||
* @returns {number} Returns the sort order indicator for `object`. | ||
* @param {*} value The value to compare. | ||
* @param {*} other The other value to compare. | ||
* @returns {number} Returns the sort order indicator for `value`. | ||
*/ | ||
function compareAscending(object, other) { | ||
return baseCompareAscending(object.criteria, other.criteria) || (object.index - other.index); | ||
function compareAscending(value, other) { | ||
if (value !== other) { | ||
var valIsNull = value === null, | ||
valIsUndef = value === undefined, | ||
valIsReflexive = value === value; | ||
var othIsNull = other === null, | ||
othIsUndef = other === undefined, | ||
othIsReflexive = other === other; | ||
if ((value > other && !othIsNull) || !valIsReflexive || | ||
(valIsNull && !othIsUndef && othIsReflexive) || | ||
(valIsUndef && othIsReflexive)) { | ||
return 1; | ||
} | ||
if ((value < other && !valIsNull) || !othIsReflexive || | ||
(othIsNull && !valIsUndef && valIsReflexive) || | ||
(othIsUndef && valIsReflexive)) { | ||
return -1; | ||
} | ||
} | ||
return 0; | ||
} | ||
module.exports = compareAscending; |
@@ -1,10 +0,10 @@ | ||
var baseCompareAscending = require('./baseCompareAscending'); | ||
var compareAscending = require('./compareAscending'); | ||
/** | ||
* Used by `_.sortByOrder` to compare multiple properties of a value to another | ||
* Used by `_.orderBy` to compare multiple properties of a value to another | ||
* and stable sort them. | ||
* | ||
* If `orders` is unspecified, all valuess are sorted in ascending order. Otherwise, | ||
* a value is sorted in ascending order if its corresponding order is "asc", and | ||
* descending if "desc". | ||
* If `orders` is unspecified, all values are sorted in ascending order. Otherwise, | ||
* specify an order of "desc" for descending or "asc" for ascending sort order | ||
* of corresponding values. | ||
* | ||
@@ -14,3 +14,3 @@ * @private | ||
* @param {Object} other The other object to compare. | ||
* @param {boolean[]} orders The order to sort by for each property. | ||
* @param {boolean[]|string[]} orders The order to sort by for each property. | ||
* @returns {number} Returns the sort order indicator for `object`. | ||
@@ -26,3 +26,3 @@ */ | ||
while (++index < length) { | ||
var result = baseCompareAscending(objCriteria[index], othCriteria[index]); | ||
var result = compareAscending(objCriteria[index], othCriteria[index]); | ||
if (result) { | ||
@@ -33,3 +33,3 @@ if (index >= ordersLength) { | ||
var order = orders[index]; | ||
return result * ((order === 'asc' || order === true) ? 1 : -1); | ||
return result * (order == 'desc' ? -1 : 1); | ||
} | ||
@@ -36,0 +36,0 @@ } |
@@ -1,2 +0,2 @@ | ||
/* Native method references for those with the same name as other `lodash` methods. */ | ||
/* Built-in method references for those with the same name as other `lodash` methods. */ | ||
var nativeMax = Math.max; | ||
@@ -3,0 +3,0 @@ |
@@ -1,2 +0,2 @@ | ||
/* Native method references for those with the same name as other `lodash` methods. */ | ||
/* Built-in method references for those with the same name as other `lodash` methods. */ | ||
var nativeMax = Math.max; | ||
@@ -3,0 +3,0 @@ |
@@ -1,7 +0,7 @@ | ||
var baseCallback = require('./baseCallback'), | ||
baseEach = require('./baseEach'), | ||
isArray = require('../lang/isArray'); | ||
var baseEach = require('./baseEach'), | ||
baseIteratee = require('./baseIteratee'), | ||
isArray = require('../isArray'); | ||
/** | ||
* Creates a `_.countBy`, `_.groupBy`, `_.indexBy`, or `_.partition` function. | ||
* Creates a function like `_.groupBy`. | ||
* | ||
@@ -14,5 +14,5 @@ * @private | ||
function createAggregator(setter, initializer) { | ||
return function(collection, iteratee, thisArg) { | ||
return function(collection, iteratee) { | ||
var result = initializer ? initializer() : {}; | ||
iteratee = baseCallback(iteratee, thisArg, 3); | ||
iteratee = baseIteratee(iteratee); | ||
@@ -25,7 +25,7 @@ if (isArray(collection)) { | ||
var value = collection[index]; | ||
setter(result, value, iteratee(value, index, collection), collection); | ||
setter(result, value, iteratee(value), collection); | ||
} | ||
} else { | ||
baseEach(collection, function(value, key, collection) { | ||
setter(result, value, iteratee(value, key, collection), collection); | ||
setter(result, value, iteratee(value), collection); | ||
}); | ||
@@ -32,0 +32,0 @@ } |
@@ -1,7 +0,6 @@ | ||
var bindCallback = require('./bindCallback'), | ||
isIterateeCall = require('./isIterateeCall'), | ||
restParam = require('../function/restParam'); | ||
var isIterateeCall = require('./isIterateeCall'), | ||
rest = require('../rest'); | ||
/** | ||
* Creates a `_.assign`, `_.defaults`, or `_.merge` function. | ||
* Creates a function like `_.assign`. | ||
* | ||
@@ -13,16 +12,9 @@ * @private | ||
function createAssigner(assigner) { | ||
return restParam(function(object, sources) { | ||
return rest(function(object, sources) { | ||
var index = -1, | ||
length = object == null ? 0 : sources.length, | ||
customizer = length > 2 ? sources[length - 2] : undefined, | ||
guard = length > 2 ? sources[2] : undefined, | ||
thisArg = length > 1 ? sources[length - 1] : undefined; | ||
length = sources.length, | ||
customizer = length > 1 ? sources[length - 1] : undefined, | ||
guard = length > 2 ? sources[2] : undefined; | ||
if (typeof customizer == 'function') { | ||
customizer = bindCallback(customizer, thisArg, 5); | ||
length -= 2; | ||
} else { | ||
customizer = typeof thisArg == 'function' ? thisArg : undefined; | ||
length -= (customizer ? 1 : 0); | ||
} | ||
customizer = typeof customizer == 'function' ? (length--, customizer) : undefined; | ||
if (guard && isIterateeCall(sources[0], sources[1], guard)) { | ||
@@ -32,2 +24,3 @@ customizer = length < 3 ? undefined : customizer; | ||
} | ||
object = Object(object); | ||
while (++index < length) { | ||
@@ -34,0 +27,0 @@ var source = sources[index]; |
@@ -1,4 +0,2 @@ | ||
var getLength = require('./getLength'), | ||
isLength = require('./isLength'), | ||
toObject = require('./toObject'); | ||
var isArrayLike = require('../isArrayLike'); | ||
@@ -15,8 +13,11 @@ /** | ||
return function(collection, iteratee) { | ||
var length = collection ? getLength(collection) : 0; | ||
if (!isLength(length)) { | ||
if (collection == null) { | ||
return collection; | ||
} | ||
if (!isArrayLike(collection)) { | ||
return eachFunc(collection, iteratee); | ||
} | ||
var index = fromRight ? length : -1, | ||
iterable = toObject(collection); | ||
var length = collection.length, | ||
index = fromRight ? length : -1, | ||
iterable = Object(collection); | ||
@@ -23,0 +24,0 @@ while ((fromRight ? index-- : ++index < length)) { |
@@ -1,5 +0,3 @@ | ||
var toObject = require('./toObject'); | ||
/** | ||
* Creates a base function for `_.forIn` or `_.forInRight`. | ||
* Creates a base function for methods like `_.forIn`. | ||
* | ||
@@ -12,9 +10,9 @@ * @private | ||
return function(object, iteratee, keysFunc) { | ||
var iterable = toObject(object), | ||
var index = -1, | ||
iterable = Object(object), | ||
props = keysFunc(object), | ||
length = props.length, | ||
index = fromRight ? length : -1; | ||
length = props.length; | ||
while ((fromRight ? index-- : ++index < length)) { | ||
var key = props[index]; | ||
while (length--) { | ||
var key = props[fromRight ? length : ++index]; | ||
if (iteratee(iterable[key], key, iterable) === false) { | ||
@@ -21,0 +19,0 @@ break; |
@@ -1,7 +0,7 @@ | ||
var deburr = require('../string/deburr'), | ||
words = require('../string/words'); | ||
var arrayReduce = require('./arrayReduce'), | ||
deburr = require('../deburr'), | ||
words = require('../words'); | ||
/** | ||
* Creates a function that produces compound words out of the words in a | ||
* given string. | ||
* Creates a function like `_.camelCase`. | ||
* | ||
@@ -14,11 +14,3 @@ * @private | ||
return function(string) { | ||
var index = -1, | ||
array = words(deburr(string)), | ||
length = array.length, | ||
result = ''; | ||
while (++index < length) { | ||
result = callback(result, array[index], index); | ||
} | ||
return result; | ||
return arrayReduce(words(deburr(string)), callback, ''); | ||
}; | ||
@@ -25,0 +17,0 @@ } |
var baseCreate = require('./baseCreate'), | ||
isObject = require('../lang/isObject'); | ||
isObject = require('../isObject'); | ||
@@ -4,0 +4,0 @@ /** |
var LodashWrapper = require('./LodashWrapper'), | ||
baseFlatten = require('./baseFlatten'), | ||
getData = require('./getData'), | ||
getFuncName = require('./getFuncName'), | ||
isArray = require('../lang/isArray'), | ||
isLaziable = require('./isLaziable'); | ||
isArray = require('../isArray'), | ||
isLaziable = require('./isLaziable'), | ||
rest = require('../rest'); | ||
@@ -27,19 +29,22 @@ /** Used to compose bitmasks for wrapper metadata. */ | ||
function createFlow(fromRight) { | ||
return function() { | ||
var wrapper, | ||
length = arguments.length, | ||
index = fromRight ? length : -1, | ||
leftIndex = 0, | ||
funcs = Array(length); | ||
return rest(function(funcs) { | ||
funcs = baseFlatten(funcs); | ||
while ((fromRight ? index-- : ++index < length)) { | ||
var func = funcs[leftIndex++] = arguments[index]; | ||
var length = funcs.length, | ||
index = length, | ||
prereq = LodashWrapper.prototype.thru; | ||
if (fromRight) { | ||
funcs.reverse(); | ||
} | ||
while (index--) { | ||
var func = funcs[index]; | ||
if (typeof func != 'function') { | ||
throw new TypeError(FUNC_ERROR_TEXT); | ||
} | ||
if (!wrapper && LodashWrapper.prototype.thru && getFuncName(func) == 'wrapper') { | ||
wrapper = new LodashWrapper([], true); | ||
if (prereq && !wrapper && getFuncName(func) == 'wrapper') { | ||
var wrapper = new LodashWrapper([], true); | ||
} | ||
} | ||
index = wrapper ? -1 : length; | ||
index = wrapper ? index : length; | ||
while (++index < length) { | ||
@@ -72,5 +77,5 @@ func = funcs[index]; | ||
}; | ||
}; | ||
}); | ||
} | ||
module.exports = createFlow; |
@@ -1,9 +0,7 @@ | ||
var arrayCopy = require('./arrayCopy'), | ||
composeArgs = require('./composeArgs'), | ||
var composeArgs = require('./composeArgs'), | ||
composeArgsRight = require('./composeArgsRight'), | ||
createCtorWrapper = require('./createCtorWrapper'), | ||
isLaziable = require('./isLaziable'), | ||
createRecurryWrapper = require('./createRecurryWrapper'), | ||
reorder = require('./reorder'), | ||
replaceHolders = require('./replaceHolders'), | ||
setData = require('./setData'); | ||
replaceHolders = require('./replaceHolders'); | ||
@@ -13,19 +11,14 @@ /** Used to compose bitmasks for wrapper metadata. */ | ||
BIND_KEY_FLAG = 2, | ||
CURRY_BOUND_FLAG = 4, | ||
CURRY_FLAG = 8, | ||
CURRY_RIGHT_FLAG = 16, | ||
PARTIAL_FLAG = 32, | ||
PARTIAL_RIGHT_FLAG = 64, | ||
ARY_FLAG = 128; | ||
ARY_FLAG = 128, | ||
FLIP_FLAG = 512; | ||
/* Native method references for those with the same name as other `lodash` methods. */ | ||
var nativeMax = Math.max; | ||
/** | ||
* Creates a function that wraps `func` and invokes it with optional `this` | ||
* binding of, partial application, and currying. | ||
* Creates a function that wraps `func` to invoke it with optional `this` | ||
* binding of `thisArg`, partial application, and currying. | ||
* | ||
* @private | ||
* @param {Function|string} func The function or method name to reference. | ||
* @param {number} bitmask The bitmask of flags. See `createWrapper` for more details. | ||
* @param {Function|string} func The function or method name to wrap. | ||
* @param {number} bitmask The bitmask of wrapper flags. See `createWrapper` for more details. | ||
* @param {*} [thisArg] The `this` binding of `func`. | ||
@@ -46,9 +39,7 @@ * @param {Array} [partials] The arguments to prepend to those provided to the new function. | ||
isCurry = bitmask & CURRY_FLAG, | ||
isCurryBound = bitmask & CURRY_BOUND_FLAG, | ||
isCurryRight = bitmask & CURRY_RIGHT_FLAG, | ||
isFlip = bitmask & FLIP_FLAG, | ||
Ctor = isBindKey ? undefined : createCtorWrapper(func); | ||
function wrapper() { | ||
// Avoid `arguments` object use disqualifying optimizations by | ||
// converting it to an array before providing it to other functions. | ||
var length = arguments.length, | ||
@@ -73,23 +64,3 @@ index = length, | ||
if (length < arity) { | ||
var newArgPos = argPos ? arrayCopy(argPos) : undefined, | ||
newArity = nativeMax(arity - length, 0), | ||
newsHolders = isCurry ? argsHolders : undefined, | ||
newHoldersRight = isCurry ? undefined : argsHolders, | ||
newPartials = isCurry ? args : undefined, | ||
newPartialsRight = isCurry ? undefined : args; | ||
bitmask |= (isCurry ? PARTIAL_FLAG : PARTIAL_RIGHT_FLAG); | ||
bitmask &= ~(isCurry ? PARTIAL_RIGHT_FLAG : PARTIAL_FLAG); | ||
if (!isCurryBound) { | ||
bitmask &= ~(BIND_FLAG | BIND_KEY_FLAG); | ||
} | ||
var newData = [func, bitmask, thisArg, newPartials, newsHolders, newPartialsRight, newHoldersRight, newArgPos, ary, newArity], | ||
result = createHybridWrapper.apply(undefined, newData); | ||
if (isLaziable(func)) { | ||
setData(result, newData); | ||
} | ||
result.placeholder = placeholder; | ||
return result; | ||
return createRecurryWrapper(func, bitmask, createHybridWrapper, placeholder, thisArg, args, argsHolders, argPos, ary, arity - length); | ||
} | ||
@@ -102,2 +73,4 @@ } | ||
args = reorder(args, argPos); | ||
} else if (isFlip && args.length > 1) { | ||
args.reverse(); | ||
} | ||
@@ -108,3 +81,3 @@ if (isAry && ary < args.length) { | ||
if (this && this !== global && this instanceof wrapper) { | ||
fn = Ctor || createCtorWrapper(func); | ||
fn = Ctor || createCtorWrapper(fn); | ||
} | ||
@@ -111,0 +84,0 @@ return fn.apply(thisBinding, args); |
@@ -1,10 +0,23 @@ | ||
var repeat = require('../string/repeat'); | ||
var repeat = require('../repeat'), | ||
stringSize = require('./stringSize'), | ||
stringToArray = require('./stringToArray'), | ||
toInteger = require('../toInteger'); | ||
/* Native method references for those with the same name as other `lodash` methods. */ | ||
var nativeCeil = Math.ceil, | ||
nativeIsFinite = global.isFinite; | ||
/** Used to compose unicode character classes. */ | ||
var rsAstralRange = '\\ud800-\\udfff', | ||
rsComboRange = '\\u0300-\\u036f\\ufe20-\\ufe23', | ||
rsVarRange = '\\ufe0e\\ufe0f'; | ||
/** Used to compose unicode capture groups. */ | ||
var rsZWJ = '\\u200d'; | ||
/** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */ | ||
var reHasComplexSymbol = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']'); | ||
/* Built-in method references for those with the same name as other `lodash` methods. */ | ||
var nativeCeil = Math.ceil; | ||
/** | ||
* Creates the padding required for `string` based on the given `length`. | ||
* The `chars` string is truncated if the number of characters exceeds `length`. | ||
* Creates the padding for `string` based on `length`. The `chars` string | ||
* is truncated if the number of characters exceeds `length`. | ||
* | ||
@@ -15,16 +28,20 @@ * @private | ||
* @param {string} [chars=' '] The string used as padding. | ||
* @returns {string} Returns the pad for `string`. | ||
* @returns {string} Returns the padding for `string`. | ||
*/ | ||
function createPadding(string, length, chars) { | ||
var strLength = string.length; | ||
length = +length; | ||
length = toInteger(length); | ||
if (strLength >= length || !nativeIsFinite(length)) { | ||
var strLength = stringSize(string); | ||
if (!length || strLength >= length) { | ||
return ''; | ||
} | ||
var padLength = length - strLength; | ||
chars = chars == null ? ' ' : (chars + ''); | ||
return repeat(chars, nativeCeil(padLength / chars.length)).slice(0, padLength); | ||
chars = chars === undefined ? ' ' : (chars + ''); | ||
var result = repeat(chars, nativeCeil(padLength / stringSize(chars))); | ||
return reHasComplexSymbol.test(chars) | ||
? stringToArray(result).slice(0, padLength).join('') | ||
: result.slice(0, padLength); | ||
} | ||
module.exports = createPadding; |
@@ -1,2 +0,3 @@ | ||
var createCtorWrapper = require('./createCtorWrapper'); | ||
var apply = require('./apply'), | ||
createCtorWrapper = require('./createCtorWrapper'); | ||
@@ -7,3 +8,3 @@ /** Used to compose bitmasks for wrapper metadata. */ | ||
/** | ||
* Creates a function that wraps `func` and invokes it with the optional `this` | ||
* Creates a function that wraps `func` to invoke it with the optional `this` | ||
* binding of `thisArg` and the `partials` prepended to those provided to | ||
@@ -13,7 +14,7 @@ * the wrapper. | ||
* @private | ||
* @param {Function} func The function to partially apply arguments to. | ||
* @param {number} bitmask The bitmask of flags. See `createWrapper` for more details. | ||
* @param {Function} func The function to wrap. | ||
* @param {number} bitmask The bitmask of wrapper flags. See `createWrapper` for more details. | ||
* @param {*} thisArg The `this` binding of `func`. | ||
* @param {Array} partials The arguments to prepend to those provided to the new function. | ||
* @returns {Function} Returns the new bound function. | ||
* @returns {Function} Returns the new wrapped function. | ||
*/ | ||
@@ -25,4 +26,2 @@ function createPartialWrapper(func, bitmask, thisArg, partials) { | ||
function wrapper() { | ||
// Avoid `arguments` object use disqualifying optimizations by | ||
// converting it to an array before providing it `func`. | ||
var argsIndex = -1, | ||
@@ -32,3 +31,4 @@ argsLength = arguments.length, | ||
leftLength = partials.length, | ||
args = Array(leftLength + argsLength); | ||
args = Array(leftLength + argsLength), | ||
fn = (this && this !== global && this instanceof wrapper) ? Ctor : func; | ||
@@ -41,4 +41,3 @@ while (++leftIndex < leftLength) { | ||
} | ||
var fn = (this && this !== global && this instanceof wrapper) ? Ctor : func; | ||
return fn.apply(isBind ? thisArg : this, args); | ||
return apply(fn, isBind ? thisArg : this, args); | ||
} | ||
@@ -45,0 +44,0 @@ return wrapper; |
@@ -1,6 +0,7 @@ | ||
/** Native method references. */ | ||
var pow = Math.pow; | ||
var toInteger = require('../toInteger'), | ||
toNumber = require('../toNumber'), | ||
toString = require('../toString'); | ||
/** | ||
* Creates a `_.ceil`, `_.floor`, or `_.round` function. | ||
* Creates a function like `_.round`. | ||
* | ||
@@ -14,6 +15,12 @@ * @private | ||
return function(number, precision) { | ||
precision = precision === undefined ? 0 : (+precision || 0); | ||
number = toNumber(number); | ||
precision = toInteger(precision); | ||
if (precision) { | ||
precision = pow(10, precision); | ||
return func(number * precision) / precision; | ||
// Shift with exponential notation to avoid floating-point issues. | ||
// See [MDN](https://mdn.io/round#Examples) for more details. | ||
var pair = (toString(number) + 'e').split('e'), | ||
value = func(pair[0] + 'e' + (+pair[1] + precision)); | ||
pair = (toString(value) + 'e').split('e'); | ||
return +(pair[0] + 'e' + (+pair[1] - precision)); | ||
} | ||
@@ -20,0 +27,0 @@ return func(number); |
var baseSetData = require('./baseSetData'), | ||
createBindWrapper = require('./createBindWrapper'), | ||
createBaseWrapper = require('./createBaseWrapper'), | ||
createCurryWrapper = require('./createCurryWrapper'), | ||
createHybridWrapper = require('./createHybridWrapper'), | ||
@@ -7,3 +8,4 @@ createPartialWrapper = require('./createPartialWrapper'), | ||
mergeData = require('./mergeData'), | ||
setData = require('./setData'); | ||
setData = require('./setData'), | ||
toInteger = require('../toInteger'); | ||
@@ -13,2 +15,4 @@ /** Used to compose bitmasks for wrapper metadata. */ | ||
BIND_KEY_FLAG = 2, | ||
CURRY_FLAG = 8, | ||
CURRY_RIGHT_FLAG = 16, | ||
PARTIAL_FLAG = 32, | ||
@@ -20,3 +24,3 @@ PARTIAL_RIGHT_FLAG = 64; | ||
/* Native method references for those with the same name as other `lodash` methods. */ | ||
/* Built-in method references for those with the same name as other `lodash` methods. */ | ||
var nativeMax = Math.max; | ||
@@ -29,4 +33,4 @@ | ||
* @private | ||
* @param {Function|string} func The function or method name to reference. | ||
* @param {number} bitmask The bitmask of flags. | ||
* @param {Function|string} func The function or method name to wrap. | ||
* @param {number} bitmask The bitmask of wrapper flags. | ||
* The bitmask may be composed of the following flags: | ||
@@ -60,3 +64,6 @@ * 1 - `_.bind` | ||
} | ||
length -= (holders ? holders.length : 0); | ||
ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0); | ||
arity = arity === undefined ? arity : toInteger(arity); | ||
length -= holders ? holders.length : 0; | ||
if (bitmask & PARTIAL_RIGHT_FLAG) { | ||
@@ -73,13 +80,21 @@ var partialsRight = partials, | ||
mergeData(newData, data); | ||
bitmask = newData[1]; | ||
arity = newData[9]; | ||
} | ||
newData[9] = arity == null | ||
func = newData[0]; | ||
bitmask = newData[1]; | ||
thisArg = newData[2]; | ||
partials = newData[3]; | ||
holders = newData[4]; | ||
arity = newData[9] = newData[9] == null | ||
? (isBindKey ? 0 : func.length) | ||
: (nativeMax(arity - length, 0) || 0); | ||
: nativeMax(newData[9] - length, 0); | ||
if (bitmask == BIND_FLAG) { | ||
var result = createBindWrapper(newData[0], newData[2]); | ||
} else if ((bitmask == PARTIAL_FLAG || bitmask == (BIND_FLAG | PARTIAL_FLAG)) && !newData[4].length) { | ||
result = createPartialWrapper.apply(undefined, newData); | ||
if (!arity && bitmask & (CURRY_FLAG | CURRY_RIGHT_FLAG)) { | ||
bitmask &= ~(CURRY_FLAG | CURRY_RIGHT_FLAG); | ||
} | ||
if (!bitmask || bitmask == BIND_FLAG) { | ||
var result = createBaseWrapper(func, bitmask, thisArg); | ||
} else if (bitmask == CURRY_FLAG || bitmask == CURRY_RIGHT_FLAG) { | ||
result = createCurryWrapper(func, bitmask, arity); | ||
} else if ((bitmask == PARTIAL_FLAG || bitmask == (BIND_FLAG | PARTIAL_FLAG)) && !holders.length) { | ||
result = createPartialWrapper(func, bitmask, thisArg, partials); | ||
} else { | ||
@@ -86,0 +101,0 @@ result = createHybridWrapper.apply(undefined, newData); |
var arraySome = require('./arraySome'); | ||
/** Used to compose bitmasks for comparison styles. */ | ||
var UNORDERED_COMPARE_FLAG = 1, | ||
PARTIAL_COMPARE_FLAG = 2; | ||
/** | ||
@@ -11,42 +15,59 @@ * A specialized version of `baseIsEqualDeep` for arrays with support for | ||
* @param {Function} equalFunc The function to determine equivalents of values. | ||
* @param {Function} [customizer] The function to customize comparing arrays. | ||
* @param {boolean} [isLoose] Specify performing partial comparisons. | ||
* @param {Array} [stackA] Tracks traversed `value` objects. | ||
* @param {Array} [stackB] Tracks traversed `other` objects. | ||
* @param {Function} [customizer] The function to customize comparisons. | ||
* @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual` for more details. | ||
* @param {Object} [stack] Tracks traversed `array` and `other` objects. | ||
* @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. | ||
*/ | ||
function equalArrays(array, other, equalFunc, customizer, isLoose, stackA, stackB) { | ||
function equalArrays(array, other, equalFunc, customizer, bitmask, stack) { | ||
var index = -1, | ||
isPartial = bitmask & PARTIAL_COMPARE_FLAG, | ||
isUnordered = bitmask & UNORDERED_COMPARE_FLAG, | ||
arrLength = array.length, | ||
othLength = other.length; | ||
if (arrLength != othLength && !(isLoose && othLength > arrLength)) { | ||
if (arrLength != othLength && !(isPartial && othLength > arrLength)) { | ||
return false; | ||
} | ||
// Assume cyclic values are equal. | ||
var stacked = stack.get(array); | ||
if (stacked) { | ||
return stacked == other; | ||
} | ||
var result = true; | ||
stack.set(array, other); | ||
// Ignore non-index properties. | ||
while (++index < arrLength) { | ||
var arrValue = array[index], | ||
othValue = other[index], | ||
result = customizer ? customizer(isLoose ? othValue : arrValue, isLoose ? arrValue : othValue, index) : undefined; | ||
othValue = other[index]; | ||
if (result !== undefined) { | ||
if (result) { | ||
if (customizer) { | ||
var compared = isPartial | ||
? customizer(othValue, arrValue, index, other, array, stack) | ||
: customizer(arrValue, othValue, index, array, other, stack); | ||
} | ||
if (compared !== undefined) { | ||
if (compared) { | ||
continue; | ||
} | ||
return false; | ||
result = false; | ||
break; | ||
} | ||
// Recursively compare arrays (susceptible to call stack limits). | ||
if (isLoose) { | ||
if (isUnordered) { | ||
if (!arraySome(other, function(othValue) { | ||
return arrValue === othValue || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB); | ||
return arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack); | ||
})) { | ||
return false; | ||
result = false; | ||
break; | ||
} | ||
} else if (!(arrValue === othValue || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB))) { | ||
return false; | ||
} else if (!(arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) { | ||
result = false; | ||
break; | ||
} | ||
} | ||
return true; | ||
stack['delete'](array); | ||
return result; | ||
} | ||
module.exports = equalArrays; |
@@ -0,1 +1,10 @@ | ||
var Uint8Array = require('./Uint8Array'), | ||
_Symbol = require('./_Symbol'), | ||
mapToArray = require('./mapToArray'), | ||
setToArray = require('./setToArray'); | ||
/** Used to compose bitmasks for comparison styles. */ | ||
var UNORDERED_COMPARE_FLAG = 1, | ||
PARTIAL_COMPARE_FLAG = 2; | ||
/** `Object#toString` result references. */ | ||
@@ -5,6 +14,15 @@ var boolTag = '[object Boolean]', | ||
errorTag = '[object Error]', | ||
mapTag = '[object Map]', | ||
numberTag = '[object Number]', | ||
regexpTag = '[object RegExp]', | ||
stringTag = '[object String]'; | ||
setTag = '[object Set]', | ||
stringTag = '[object String]', | ||
symbolTag = '[object Symbol]'; | ||
var arrayBufferTag = '[object ArrayBuffer]'; | ||
/** Used to convert symbols to primitives and strings. */ | ||
var symbolProto = _Symbol ? _Symbol.prototype : undefined, | ||
symbolValueOf = _Symbol ? symbolProto.valueOf : undefined; | ||
/** | ||
@@ -21,6 +39,16 @@ * A specialized version of `baseIsEqualDeep` for comparing objects of | ||
* @param {string} tag The `toStringTag` of the objects to compare. | ||
* @param {Function} equalFunc The function to determine equivalents of values. | ||
* @param {Function} [customizer] The function to customize comparisons. | ||
* @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual` for more details. | ||
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`. | ||
*/ | ||
function equalByTag(object, other, tag) { | ||
function equalByTag(object, other, tag, equalFunc, customizer, bitmask) { | ||
switch (tag) { | ||
case arrayBufferTag: | ||
if ((object.byteLength != other.byteLength) || | ||
!equalFunc(new Uint8Array(object), new Uint8Array(other))) { | ||
return false; | ||
} | ||
return true; | ||
case boolTag: | ||
@@ -37,5 +65,3 @@ case dateTag: | ||
// Treat `NaN` vs. `NaN` as equal. | ||
return (object != +object) | ||
? other != +other | ||
: object == +other; | ||
return (object != +object) ? other != +other : object == +other; | ||
@@ -47,2 +73,16 @@ case regexpTag: | ||
return object == (other + ''); | ||
case mapTag: | ||
var convert = mapToArray; | ||
case setTag: | ||
var isPartial = bitmask & PARTIAL_COMPARE_FLAG; | ||
convert || (convert = setToArray); | ||
// Recursively compare objects (susceptible to call stack limits). | ||
return (isPartial || object.size == other.size) && | ||
equalFunc(convert(object), convert(other), customizer, bitmask | UNORDERED_COMPARE_FLAG); | ||
case symbolTag: | ||
return !!_Symbol && (symbolValueOf.call(object) == symbolValueOf.call(other)); | ||
} | ||
@@ -49,0 +89,0 @@ return false; |
@@ -1,9 +0,8 @@ | ||
var keys = require('../object/keys'); | ||
var baseHas = require('./baseHas'), | ||
keys = require('../keys'); | ||
/** Used for native method references. */ | ||
var objectProto = Object.prototype; | ||
/** Used to compose bitmasks for comparison styles. */ | ||
var UNORDERED_COMPARE_FLAG = 1, | ||
PARTIAL_COMPARE_FLAG = 2; | ||
/** Used to check objects for own properties. */ | ||
var hasOwnProperty = objectProto.hasOwnProperty; | ||
/** | ||
@@ -17,10 +16,11 @@ * A specialized version of `baseIsEqualDeep` for objects with support for | ||
* @param {Function} equalFunc The function to determine equivalents of values. | ||
* @param {Function} [customizer] The function to customize comparing values. | ||
* @param {boolean} [isLoose] Specify performing partial comparisons. | ||
* @param {Array} [stackA] Tracks traversed `value` objects. | ||
* @param {Array} [stackB] Tracks traversed `other` objects. | ||
* @param {Function} [customizer] The function to customize comparisons. | ||
* @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual` for more details. | ||
* @param {Object} [stack] Tracks traversed `object` and `other` objects. | ||
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`. | ||
*/ | ||
function equalObjects(object, other, equalFunc, customizer, isLoose, stackA, stackB) { | ||
var objProps = keys(object), | ||
function equalObjects(object, other, equalFunc, customizer, bitmask, stack) { | ||
var isPartial = bitmask & PARTIAL_COMPARE_FLAG, | ||
isUnordered = bitmask & UNORDERED_COMPARE_FLAG, | ||
objProps = keys(object), | ||
objLength = objProps.length, | ||
@@ -30,3 +30,3 @@ othProps = keys(other), | ||
if (objLength != othLength && !isLoose) { | ||
if (objLength != othLength && !isPartial) { | ||
return false; | ||
@@ -37,20 +37,37 @@ } | ||
var key = objProps[index]; | ||
if (!(isLoose ? key in other : hasOwnProperty.call(other, key))) { | ||
if (!(isPartial ? key in other : baseHas(other, key)) || | ||
!(isUnordered || key == othProps[index])) { | ||
return false; | ||
} | ||
} | ||
var skipCtor = isLoose; | ||
// Assume cyclic values are equal. | ||
var stacked = stack.get(object); | ||
if (stacked) { | ||
return stacked == other; | ||
} | ||
var result = true; | ||
stack.set(object, other); | ||
var skipCtor = isPartial; | ||
while (++index < objLength) { | ||
key = objProps[index]; | ||
var objValue = object[key], | ||
othValue = other[key], | ||
result = customizer ? customizer(isLoose ? othValue : objValue, isLoose? objValue : othValue, key) : undefined; | ||
othValue = other[key]; | ||
if (customizer) { | ||
var compared = isPartial | ||
? customizer(othValue, objValue, key, other, object, stack) | ||
: customizer(objValue, othValue, key, object, other, stack); | ||
} | ||
// Recursively compare objects (susceptible to call stack limits). | ||
if (!(result === undefined ? equalFunc(objValue, othValue, customizer, isLoose, stackA, stackB) : result)) { | ||
return false; | ||
if (!(compared === undefined | ||
? (objValue === othValue || equalFunc(objValue, othValue, customizer, bitmask, stack)) | ||
: compared | ||
)) { | ||
result = false; | ||
break; | ||
} | ||
skipCtor || (skipCtor = key == 'constructor'); | ||
} | ||
if (!skipCtor) { | ||
if (result && !skipCtor) { | ||
var objCtor = object.constructor, | ||
@@ -64,8 +81,9 @@ othCtor = other.constructor; | ||
typeof othCtor == 'function' && othCtor instanceof othCtor)) { | ||
return false; | ||
result = false; | ||
} | ||
} | ||
return true; | ||
stack['delete'](object); | ||
return result; | ||
} | ||
module.exports = equalObjects; |
var metaMap = require('./metaMap'), | ||
noop = require('../utility/noop'); | ||
noop = require('../noop'); | ||
@@ -4,0 +4,0 @@ /** |
var isStrictComparable = require('./isStrictComparable'), | ||
pairs = require('../object/pairs'); | ||
toPairs = require('../toPairs'); | ||
/** | ||
* Gets the propery names, values, and compare flags of `object`. | ||
* Gets the property names, values, and compare flags of `object`. | ||
* | ||
@@ -12,3 +12,3 @@ * @private | ||
function getMatchData(object) { | ||
var result = pairs(object), | ||
var result = toPairs(object), | ||
length = result.length; | ||
@@ -15,0 +15,0 @@ |
@@ -1,2 +0,2 @@ | ||
var isNative = require('../lang/isNative'); | ||
var isNative = require('../isNative'); | ||
@@ -3,0 +3,0 @@ /** |
@@ -1,2 +0,2 @@ | ||
/* Native method references for those with the same name as other `lodash` methods. */ | ||
/* Built-in method references for those with the same name as other `lodash` methods. */ | ||
var nativeMax = Math.max, | ||
@@ -3,0 +3,0 @@ nativeMin = Math.min; |
@@ -1,3 +0,3 @@ | ||
/** Used for native method references. */ | ||
var objectProto = Object.prototype; | ||
/** Used for built-in method references. */ | ||
var objectProto = global.Object.prototype; | ||
@@ -16,5 +16,5 @@ /** Used to check objects for own properties. */ | ||
var length = array.length, | ||
result = new array.constructor(length); | ||
result = array.constructor(length); | ||
// Add array properties assigned by `RegExp#exec`. | ||
// Add properties assigned by `RegExp#exec`. | ||
if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) { | ||
@@ -21,0 +21,0 @@ result.index = array.index; |
@@ -1,2 +0,7 @@ | ||
var bufferClone = require('./bufferClone'); | ||
var cloneBuffer = require('./cloneBuffer'), | ||
cloneMap = require('./cloneMap'), | ||
cloneRegExp = require('./cloneRegExp'), | ||
cloneSet = require('./cloneSet'), | ||
cloneSymbol = require('./cloneSymbol'), | ||
cloneTypedArray = require('./cloneTypedArray'); | ||
@@ -6,5 +11,8 @@ /** `Object#toString` result references. */ | ||
dateTag = '[object Date]', | ||
mapTag = '[object Map]', | ||
numberTag = '[object Number]', | ||
regexpTag = '[object RegExp]', | ||
stringTag = '[object String]'; | ||
setTag = '[object Set]', | ||
stringTag = '[object String]', | ||
symbolTag = '[object Symbol]'; | ||
@@ -22,5 +30,2 @@ var arrayBufferTag = '[object ArrayBuffer]', | ||
/** Used to match `RegExp` flags from their coerced string values. */ | ||
var reFlags = /\w*$/; | ||
/** | ||
@@ -42,3 +47,3 @@ * Initializes an object clone based on its `toStringTag`. | ||
case arrayBufferTag: | ||
return bufferClone(object); | ||
return cloneBuffer(object); | ||
@@ -52,5 +57,7 @@ case boolTag: | ||
case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag: | ||
var buffer = object.buffer; | ||
return new Ctor(isDeep ? bufferClone(buffer) : buffer, object.byteOffset, object.length); | ||
return cloneTypedArray(object, isDeep); | ||
case mapTag: | ||
return cloneMap(object); | ||
case numberTag: | ||
@@ -61,8 +68,12 @@ case stringTag: | ||
case regexpTag: | ||
var result = new Ctor(object.source, reFlags.exec(object)); | ||
result.lastIndex = object.lastIndex; | ||
return cloneRegExp(object); | ||
case setTag: | ||
return cloneSet(object); | ||
case symbolTag: | ||
return cloneSymbol(object); | ||
} | ||
return result; | ||
} | ||
module.exports = initCloneByTag; |
@@ -0,1 +1,4 @@ | ||
var baseCreate = require('./baseCreate'), | ||
isFunction = require('../isFunction'); | ||
/** | ||
@@ -10,8 +13,5 @@ * Initializes an object clone. | ||
var Ctor = object.constructor; | ||
if (!(typeof Ctor == 'function' && Ctor instanceof Ctor)) { | ||
Ctor = Object; | ||
} | ||
return new Ctor; | ||
return baseCreate(isFunction(Ctor) ? Ctor.prototype : undefined); | ||
} | ||
module.exports = initCloneObject; |
@@ -0,11 +1,8 @@ | ||
/** Used as references for various `Number` constants. */ | ||
var MAX_SAFE_INTEGER = 9007199254740991; | ||
/** Used to detect unsigned integer values. */ | ||
var reIsUint = /^\d+$/; | ||
var reIsUint = /^(?:0|[1-9]\d*)$/; | ||
/** | ||
* Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer) | ||
* of an array-like value. | ||
*/ | ||
var MAX_SAFE_INTEGER = 9007199254740991; | ||
/** | ||
* Checks if `value` is a valid array-like index. | ||
@@ -12,0 +9,0 @@ * |
@@ -1,4 +0,5 @@ | ||
var isArrayLike = require('./isArrayLike'), | ||
var eq = require('../eq'), | ||
isArrayLike = require('../isArrayLike'), | ||
isIndex = require('./isIndex'), | ||
isObject = require('../lang/isObject'); | ||
isObject = require('../isObject'); | ||
@@ -22,4 +23,3 @@ /** | ||
: (type == 'string' && index in object)) { | ||
var other = object[index]; | ||
return value === value ? (value === other) : (other !== other); | ||
return eq(object[index], value); | ||
} | ||
@@ -26,0 +26,0 @@ return false; |
@@ -1,6 +0,5 @@ | ||
var isArray = require('../lang/isArray'), | ||
toObject = require('./toObject'); | ||
var isArray = require('../isArray'); | ||
/** Used to match property names within property paths. */ | ||
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/, | ||
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, | ||
reIsPlainProp = /^\w*$/; | ||
@@ -17,13 +16,10 @@ | ||
function isKey(value, object) { | ||
var type = typeof value; | ||
if ((type == 'string' && reIsPlainProp.test(value)) || type == 'number') { | ||
if (typeof value == 'number') { | ||
return true; | ||
} | ||
if (isArray(value)) { | ||
return false; | ||
} | ||
var result = !reIsDeepProp.test(value); | ||
return result || (object != null && value in toObject(object)); | ||
return !isArray(value) && | ||
(reIsPlainProp.test(value) || !reIsDeepProp.test(value) || | ||
(object != null && value in Object(object))); | ||
} | ||
module.exports = isKey; |
var LazyWrapper = require('./LazyWrapper'), | ||
getData = require('./getData'), | ||
getFuncName = require('./getFuncName'), | ||
lodash = require('../chain/lodash'); | ||
lodash = require('../wrapperLodash'); | ||
@@ -6,0 +6,0 @@ /** |
@@ -1,2 +0,2 @@ | ||
var isObject = require('../lang/isObject'); | ||
var isObject = require('../isObject'); | ||
@@ -3,0 +3,0 @@ /** |
var LazyWrapper = require('./LazyWrapper'), | ||
arrayCopy = require('./arrayCopy'); | ||
copyArray = require('./copyArray'); | ||
@@ -14,8 +14,8 @@ /** | ||
var result = new LazyWrapper(this.__wrapped__); | ||
result.__actions__ = arrayCopy(this.__actions__); | ||
result.__actions__ = copyArray(this.__actions__); | ||
result.__dir__ = this.__dir__; | ||
result.__filtered__ = this.__filtered__; | ||
result.__iteratees__ = arrayCopy(this.__iteratees__); | ||
result.__iteratees__ = copyArray(this.__iteratees__); | ||
result.__takeCount__ = this.__takeCount__; | ||
result.__views__ = arrayCopy(this.__views__); | ||
result.__views__ = copyArray(this.__views__); | ||
return result; | ||
@@ -22,0 +22,0 @@ } |
var baseWrapperValue = require('./baseWrapperValue'), | ||
getView = require('./getView'), | ||
isArray = require('../lang/isArray'); | ||
isArray = require('../isArray'); | ||
@@ -12,3 +12,3 @@ /** Used as the size to enable large array optimizations. */ | ||
/* Native method references for those with the same name as other `lodash` methods. */ | ||
/* Built-in method references for those with the same name as other `lodash` methods. */ | ||
var nativeMin = Math.min; | ||
@@ -15,0 +15,0 @@ |
var baseCreate = require('./baseCreate'), | ||
baseLodash = require('./baseLodash'); | ||
/** Used as references for `-Infinity` and `Infinity`. */ | ||
var POSITIVE_INFINITY = Number.POSITIVE_INFINITY; | ||
/** Used as references for the maximum length and index of an array. */ | ||
var MAX_ARRAY_LENGTH = 4294967295; | ||
@@ -19,3 +19,3 @@ /** | ||
this.__iteratees__ = []; | ||
this.__takeCount__ = POSITIVE_INFINITY; | ||
this.__takeCount__ = MAX_ARRAY_LENGTH; | ||
this.__views__ = []; | ||
@@ -22,0 +22,0 @@ } |
@@ -10,8 +10,9 @@ var baseCreate = require('./baseCreate'), | ||
* @param {boolean} [chainAll] Enable chaining for all wrapper methods. | ||
* @param {Array} [actions=[]] Actions to peform to resolve the unwrapped value. | ||
*/ | ||
function LodashWrapper(value, chainAll, actions) { | ||
function LodashWrapper(value, chainAll) { | ||
this.__wrapped__ = value; | ||
this.__actions__ = actions || []; | ||
this.__actions__ = []; | ||
this.__chain__ = !!chainAll; | ||
this.__index__ = 0; | ||
this.__values__ = undefined; | ||
} | ||
@@ -18,0 +19,0 @@ |
@@ -1,2 +0,3 @@ | ||
var mapDelete = require('./mapDelete'), | ||
var mapClear = require('./mapClear'), | ||
mapDelete = require('./mapDelete'), | ||
mapGet = require('./mapGet'), | ||
@@ -7,14 +8,20 @@ mapHas = require('./mapHas'), | ||
/** | ||
* Creates a cache object to store key/value pairs. | ||
* Creates a map cache object to store key-value pairs. | ||
* | ||
* @private | ||
* @static | ||
* @name Cache | ||
* @memberOf _.memoize | ||
* @param {Array} [values] The values to cache. | ||
*/ | ||
function MapCache() { | ||
this.__data__ = {}; | ||
function MapCache(values) { | ||
var index = -1, | ||
length = values ? values.length : 0; | ||
this.clear(); | ||
while (++index < length) { | ||
var entry = values[index]; | ||
this.set(entry[0], entry[1]); | ||
} | ||
} | ||
// Add functions to the `Map` cache. | ||
// Add functions to the `MapCache`. | ||
MapCache.prototype.clear = mapClear; | ||
MapCache.prototype['delete'] = mapDelete; | ||
@@ -21,0 +28,0 @@ MapCache.prototype.get = mapGet; |
@@ -0,14 +1,23 @@ | ||
var Map = require('./Map'), | ||
assocDelete = require('./assocDelete'), | ||
hashDelete = require('./hashDelete'), | ||
isKeyable = require('./isKeyable'); | ||
/** | ||
* Removes `key` and its value from the cache. | ||
* Removes `key` and its value from the map. | ||
* | ||
* @private | ||
* @name delete | ||
* @memberOf _.memoize.Cache | ||
* @memberOf MapCache | ||
* @param {string} key The key of the value to remove. | ||
* @returns {boolean} Returns `true` if the entry was removed successfully, else `false`. | ||
* @returns {boolean} Returns `true` if the entry was removed, else `false`. | ||
*/ | ||
function mapDelete(key) { | ||
return this.has(key) && delete this.__data__[key]; | ||
var data = this.__data__; | ||
if (isKeyable(key)) { | ||
return hashDelete(typeof key == 'string' ? data.string : data.hash, key); | ||
} | ||
return Map ? data.map['delete'](key) : assocDelete(data.map, key); | ||
} | ||
module.exports = mapDelete; |
@@ -0,14 +1,23 @@ | ||
var Map = require('./Map'), | ||
assocGet = require('./assocGet'), | ||
hashGet = require('./hashGet'), | ||
isKeyable = require('./isKeyable'); | ||
/** | ||
* Gets the cached value for `key`. | ||
* Gets the map value for `key`. | ||
* | ||
* @private | ||
* @name get | ||
* @memberOf _.memoize.Cache | ||
* @memberOf MapCache | ||
* @param {string} key The key of the value to get. | ||
* @returns {*} Returns the cached value. | ||
* @returns {*} Returns the entry value. | ||
*/ | ||
function mapGet(key) { | ||
return key == '__proto__' ? undefined : this.__data__[key]; | ||
var data = this.__data__; | ||
if (isKeyable(key)) { | ||
return hashGet(typeof key == 'string' ? data.string : data.hash, key); | ||
} | ||
return Map ? data.map.get(key) : assocGet(data.map, key); | ||
} | ||
module.exports = mapGet; |
@@ -1,13 +0,12 @@ | ||
/** Used for native method references. */ | ||
var objectProto = Object.prototype; | ||
var Map = require('./Map'), | ||
assocHas = require('./assocHas'), | ||
hashHas = require('./hashHas'), | ||
isKeyable = require('./isKeyable'); | ||
/** Used to check objects for own properties. */ | ||
var hasOwnProperty = objectProto.hasOwnProperty; | ||
/** | ||
* Checks if a cached value for `key` exists. | ||
* Checks if a map value for `key` exists. | ||
* | ||
* @private | ||
* @name has | ||
* @memberOf _.memoize.Cache | ||
* @memberOf MapCache | ||
* @param {string} key The key of the entry to check. | ||
@@ -17,5 +16,9 @@ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. | ||
function mapHas(key) { | ||
return key != '__proto__' && hasOwnProperty.call(this.__data__, key); | ||
var data = this.__data__; | ||
if (isKeyable(key)) { | ||
return hashHas(typeof key == 'string' ? data.string : data.hash, key); | ||
} | ||
return Map ? data.map.has(key) : assocHas(data.map, key); | ||
} | ||
module.exports = mapHas; |
@@ -0,14 +1,24 @@ | ||
var Map = require('./Map'), | ||
assocSet = require('./assocSet'), | ||
hashSet = require('./hashSet'), | ||
isKeyable = require('./isKeyable'); | ||
/** | ||
* Sets `value` to `key` of the cache. | ||
* Sets the map `key` to `value`. | ||
* | ||
* @private | ||
* @name set | ||
* @memberOf _.memoize.Cache | ||
* @param {string} key The key of the value to cache. | ||
* @param {*} value The value to cache. | ||
* @returns {Object} Returns the cache object. | ||
* @memberOf MapCache | ||
* @param {string} key The key of the value to set. | ||
* @param {*} value The value to set. | ||
* @returns {Object} Returns the map cache object. | ||
*/ | ||
function mapSet(key, value) { | ||
if (key != '__proto__') { | ||
this.__data__[key] = value; | ||
var data = this.__data__; | ||
if (isKeyable(key)) { | ||
hashSet(typeof key == 'string' ? data.string : data.hash, key, value); | ||
} else if (Map) { | ||
data.map.set(key, value); | ||
} else { | ||
assocSet(data.map, key, value); | ||
} | ||
@@ -15,0 +25,0 @@ return this; |
@@ -1,4 +0,4 @@ | ||
var arrayCopy = require('./arrayCopy'), | ||
composeArgs = require('./composeArgs'), | ||
var composeArgs = require('./composeArgs'), | ||
composeArgsRight = require('./composeArgsRight'), | ||
copyArray = require('./copyArray'), | ||
replaceHolders = require('./replaceHolders'); | ||
@@ -8,2 +8,3 @@ | ||
var BIND_FLAG = 1, | ||
BIND_KEY_FLAG = 2, | ||
CURRY_BOUND_FLAG = 4, | ||
@@ -17,3 +18,3 @@ CURRY_FLAG = 8, | ||
/* Native method references for those with the same name as other `lodash` methods. */ | ||
/* Built-in method references for those with the same name as other `lodash` methods. */ | ||
var nativeMin = Math.min; | ||
@@ -24,8 +25,8 @@ | ||
* | ||
* Merging metadata reduces the number of wrappers required to invoke a function. | ||
* Merging metadata reduces the number of wrappers used to invoke a function. | ||
* This is possible because methods like `_.bind`, `_.curry`, and `_.partial` | ||
* may be applied regardless of execution order. Methods like `_.ary` and `_.rearg` | ||
* augment function arguments, making the order in which they are executed important, | ||
* modify function arguments, making the order in which they are executed important, | ||
* preventing the merging of metadata. However, we make an exception for a safe | ||
* common case where curried functions have `_.ary` and or `_.rearg` applied. | ||
* combined case where curried functions have `_.ary` and or `_.rearg` applied. | ||
* | ||
@@ -41,8 +42,8 @@ * @private | ||
newBitmask = bitmask | srcBitmask, | ||
isCommon = newBitmask < ARY_FLAG; | ||
isCommon = newBitmask < (BIND_FLAG | BIND_KEY_FLAG | ARY_FLAG); | ||
var isCombo = | ||
(srcBitmask == ARY_FLAG && bitmask == CURRY_FLAG) || | ||
(srcBitmask == ARY_FLAG && bitmask == REARG_FLAG && data[7].length <= source[8]) || | ||
(srcBitmask == (ARY_FLAG | REARG_FLAG) && bitmask == CURRY_FLAG); | ||
(srcBitmask == ARY_FLAG && (bitmask == CURRY_FLAG)) || | ||
(srcBitmask == ARY_FLAG && (bitmask == REARG_FLAG) && (data[7].length <= source[8])) || | ||
(srcBitmask == (ARY_FLAG | REARG_FLAG) && (source[7].length <= source[8]) && (bitmask == CURRY_FLAG)); | ||
@@ -63,4 +64,4 @@ // Exit early if metadata can't be merged. | ||
var partials = data[3]; | ||
data[3] = partials ? composeArgs(partials, value, source[4]) : arrayCopy(value); | ||
data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : arrayCopy(source[4]); | ||
data[3] = partials ? composeArgs(partials, value, source[4]) : copyArray(value); | ||
data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : copyArray(source[4]); | ||
} | ||
@@ -71,4 +72,4 @@ // Compose partial right arguments. | ||
partials = data[5]; | ||
data[5] = partials ? composeArgsRight(partials, value, source[6]) : arrayCopy(value); | ||
data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : arrayCopy(source[6]); | ||
data[5] = partials ? composeArgsRight(partials, value, source[6]) : copyArray(value); | ||
data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : copyArray(source[6]); | ||
} | ||
@@ -78,3 +79,3 @@ // Use source `argPos` if available. | ||
if (value) { | ||
data[7] = arrayCopy(value); | ||
data[7] = copyArray(value); | ||
} | ||
@@ -81,0 +82,0 @@ // Use source `ary` if it's smaller. |
@@ -1,2 +0,4 @@ | ||
var merge = require('../object/merge'); | ||
var baseClone = require('./baseClone'), | ||
baseMerge = require('./baseMerge'), | ||
isObject = require('../isObject'); | ||
@@ -7,10 +9,18 @@ /** | ||
* @private | ||
* @param {*} objectValue The destination object property value. | ||
* @param {*} sourceValue The source object property value. | ||
* @returns {*} Returns the value to assign to the destination object. | ||
* @param {*} objValue The destination value. | ||
* @param {*} srcValue The source value. | ||
* @param {string} key The key of the property to merge. | ||
* @param {Object} object The parent object of `objValue`. | ||
* @param {Object} source The parent object of `srcValue`. | ||
* @param {Object} [stack] Tracks traversed source values and their merged counterparts. | ||
* @returns {*} Returns the value to assign. | ||
*/ | ||
function mergeDefaults(objectValue, sourceValue) { | ||
return objectValue === undefined ? sourceValue : merge(objectValue, sourceValue, mergeDefaults); | ||
function mergeDefaults(objValue, srcValue, key, object, source, stack) { | ||
if (isObject(objValue) && isObject(srcValue)) { | ||
stack.set(srcValue, objValue); | ||
baseMerge(objValue, srcValue, mergeDefaults, stack); | ||
} | ||
return objValue === undefined ? baseClone(srcValue) : objValue; | ||
} | ||
module.exports = mergeDefaults; |
@@ -1,6 +0,3 @@ | ||
var getNative = require('./getNative'); | ||
var WeakMap = require('./WeakMap'); | ||
/** Native method references. */ | ||
var WeakMap = getNative(global, 'WeakMap'); | ||
/** Used to store function metadata. */ | ||
@@ -7,0 +4,0 @@ var metaMap = WeakMap && new WeakMap; |
@@ -1,5 +0,5 @@ | ||
var arrayCopy = require('./arrayCopy'), | ||
var copyArray = require('./copyArray'), | ||
isIndex = require('./isIndex'); | ||
/* Native method references for those with the same name as other `lodash` methods. */ | ||
/* Built-in method references for those with the same name as other `lodash` methods. */ | ||
var nativeMin = Math.min; | ||
@@ -20,3 +20,3 @@ | ||
length = nativeMin(indexes.length, arrLength), | ||
oldArray = arrayCopy(array); | ||
oldArray = copyArray(array); | ||
@@ -23,0 +23,0 @@ while (length--) { |
@@ -1,13 +0,7 @@ | ||
var cachePush = require('./cachePush'), | ||
getNative = require('./getNative'); | ||
var MapCache = require('./MapCache'), | ||
cachePush = require('./cachePush'); | ||
/** Native method references. */ | ||
var Set = getNative(global, 'Set'); | ||
/* Native method references for those with the same name as other `lodash` methods. */ | ||
var nativeCreate = getNative(Object, 'create'); | ||
/** | ||
* | ||
* Creates a cache object to store unique values. | ||
* Creates a set cache object to store unique values. | ||
* | ||
@@ -18,13 +12,14 @@ * @private | ||
function SetCache(values) { | ||
var length = values ? values.length : 0; | ||
var index = -1, | ||
length = values ? values.length : 0; | ||
this.data = { 'hash': nativeCreate(null), 'set': new Set }; | ||
while (length--) { | ||
this.push(values[length]); | ||
this.__data__ = new MapCache; | ||
while (++index < length) { | ||
this.push(values[index]); | ||
} | ||
} | ||
// Add functions to the `Set` cache. | ||
// Add functions to the `SetCache`. | ||
SetCache.prototype.push = cachePush; | ||
module.exports = SetCache; |
var baseSetData = require('./baseSetData'), | ||
now = require('../date/now'); | ||
now = require('../now'); | ||
/** Used to detect when a function becomes hot. */ | ||
/** Used to detect hot functions by number of calls within a span of milliseconds. */ | ||
var HOT_COUNT = 150, | ||
@@ -6,0 +6,0 @@ HOT_SPAN = 16; |
var LazyWrapper = require('./LazyWrapper'), | ||
LodashWrapper = require('./LodashWrapper'), | ||
arrayCopy = require('./arrayCopy'); | ||
copyArray = require('./copyArray'); | ||
@@ -13,7 +13,12 @@ /** | ||
function wrapperClone(wrapper) { | ||
return wrapper instanceof LazyWrapper | ||
? wrapper.clone() | ||
: new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__, arrayCopy(wrapper.__actions__)); | ||
if (wrapper instanceof LazyWrapper) { | ||
return wrapper.clone(); | ||
} | ||
var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__); | ||
result.__actions__ = copyArray(wrapper.__actions__); | ||
result.__index__ = wrapper.__index__; | ||
result.__values__ = wrapper.__values__; | ||
return result; | ||
} | ||
module.exports = wrapperClone; |
77
lang.js
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'), | ||
'isArray': require('./lang/isArray'), | ||
'isBoolean': require('./lang/isBoolean'), | ||
'isDate': require('./lang/isDate'), | ||
'isElement': require('./lang/isElement'), | ||
'isEmpty': require('./lang/isEmpty'), | ||
'isEqual': require('./lang/isEqual'), | ||
'isError': require('./lang/isError'), | ||
'isFinite': require('./lang/isFinite'), | ||
'isFunction': require('./lang/isFunction'), | ||
'isMatch': require('./lang/isMatch'), | ||
'isNaN': require('./lang/isNaN'), | ||
'isNative': require('./lang/isNative'), | ||
'isNull': require('./lang/isNull'), | ||
'isNumber': require('./lang/isNumber'), | ||
'isObject': require('./lang/isObject'), | ||
'isPlainObject': require('./lang/isPlainObject'), | ||
'isRegExp': require('./lang/isRegExp'), | ||
'isString': require('./lang/isString'), | ||
'isTypedArray': require('./lang/isTypedArray'), | ||
'isUndefined': require('./lang/isUndefined'), | ||
'lt': require('./lang/lt'), | ||
'lte': require('./lang/lte'), | ||
'toArray': require('./lang/toArray'), | ||
'toPlainObject': require('./lang/toPlainObject') | ||
'clone': require('./clone'), | ||
'cloneDeep': require('./cloneDeep'), | ||
'cloneDeepWith': require('./cloneDeepWith'), | ||
'cloneWith': require('./cloneWith'), | ||
'eq': require('./eq'), | ||
'gt': require('./gt'), | ||
'gte': require('./gte'), | ||
'isArguments': require('./isArguments'), | ||
'isArray': require('./isArray'), | ||
'isArrayLike': require('./isArrayLike'), | ||
'isArrayLikeObject': require('./isArrayLikeObject'), | ||
'isBoolean': require('./isBoolean'), | ||
'isDate': require('./isDate'), | ||
'isElement': require('./isElement'), | ||
'isEmpty': require('./isEmpty'), | ||
'isEqual': require('./isEqual'), | ||
'isEqualWith': require('./isEqualWith'), | ||
'isError': require('./isError'), | ||
'isFinite': require('./isFinite'), | ||
'isFunction': require('./isFunction'), | ||
'isInteger': require('./isInteger'), | ||
'isLength': require('./isLength'), | ||
'isMatch': require('./isMatch'), | ||
'isMatchWith': require('./isMatchWith'), | ||
'isNaN': require('./isNaN'), | ||
'isNative': require('./isNative'), | ||
'isNil': require('./isNil'), | ||
'isNull': require('./isNull'), | ||
'isNumber': require('./isNumber'), | ||
'isObject': require('./isObject'), | ||
'isObjectLike': require('./isObjectLike'), | ||
'isPlainObject': require('./isPlainObject'), | ||
'isRegExp': require('./isRegExp'), | ||
'isSafeInteger': require('./isSafeInteger'), | ||
'isString': require('./isString'), | ||
'isSymbol': require('./isSymbol'), | ||
'isTypedArray': require('./isTypedArray'), | ||
'isUndefined': require('./isUndefined'), | ||
'lt': require('./lt'), | ||
'lte': require('./lte'), | ||
'toArray': require('./toArray'), | ||
'toInteger': require('./toInteger'), | ||
'toLength': require('./toLength'), | ||
'toNumber': require('./toNumber'), | ||
'toPlainObject': require('./toPlainObject'), | ||
'toSafeInteger': require('./toSafeInteger'), | ||
'toString': require('./toString') | ||
}; |
19
math.js
module.exports = { | ||
'add': require('./math/add'), | ||
'ceil': require('./math/ceil'), | ||
'floor': require('./math/floor'), | ||
'max': require('./math/max'), | ||
'min': require('./math/min'), | ||
'round': require('./math/round'), | ||
'sum': require('./math/sum') | ||
'add': require('./add'), | ||
'ceil': require('./ceil'), | ||
'floor': require('./floor'), | ||
'max': require('./max'), | ||
'maxBy': require('./maxBy'), | ||
'mean': require('./mean'), | ||
'min': require('./min'), | ||
'minBy': require('./minBy'), | ||
'round': require('./round'), | ||
'subtract': require('./subtract'), | ||
'sum': require('./sum'), | ||
'sumBy': require('./sumBy') | ||
}; |
module.exports = { | ||
'inRange': require('./number/inRange'), | ||
'random': require('./number/random') | ||
'clamp': require('./clamp'), | ||
'inRange': require('./inRange'), | ||
'random': require('./random') | ||
}; |
module.exports = { | ||
'assign': require('./object/assign'), | ||
'create': require('./object/create'), | ||
'defaults': require('./object/defaults'), | ||
'defaultsDeep': require('./object/defaultsDeep'), | ||
'extend': require('./object/extend'), | ||
'findKey': require('./object/findKey'), | ||
'findLastKey': require('./object/findLastKey'), | ||
'forIn': require('./object/forIn'), | ||
'forInRight': require('./object/forInRight'), | ||
'forOwn': require('./object/forOwn'), | ||
'forOwnRight': require('./object/forOwnRight'), | ||
'functions': require('./object/functions'), | ||
'get': require('./object/get'), | ||
'has': require('./object/has'), | ||
'invert': require('./object/invert'), | ||
'keys': require('./object/keys'), | ||
'keysIn': require('./object/keysIn'), | ||
'mapKeys': require('./object/mapKeys'), | ||
'mapValues': require('./object/mapValues'), | ||
'merge': require('./object/merge'), | ||
'methods': require('./object/methods'), | ||
'omit': require('./object/omit'), | ||
'pairs': require('./object/pairs'), | ||
'pick': require('./object/pick'), | ||
'result': require('./object/result'), | ||
'set': require('./object/set'), | ||
'transform': require('./object/transform'), | ||
'values': require('./object/values'), | ||
'valuesIn': require('./object/valuesIn') | ||
'assign': require('./assign'), | ||
'assignIn': require('./assignIn'), | ||
'assignInWith': require('./assignInWith'), | ||
'assignWith': require('./assignWith'), | ||
'create': require('./create'), | ||
'defaults': require('./defaults'), | ||
'defaultsDeep': require('./defaultsDeep'), | ||
'findKey': require('./findKey'), | ||
'findLastKey': require('./findLastKey'), | ||
'forIn': require('./forIn'), | ||
'forInRight': require('./forInRight'), | ||
'forOwn': require('./forOwn'), | ||
'forOwnRight': require('./forOwnRight'), | ||
'functions': require('./functions'), | ||
'functionsIn': require('./functionsIn'), | ||
'get': require('./get'), | ||
'has': require('./has'), | ||
'hasIn': require('./hasIn'), | ||
'invert': require('./invert'), | ||
'invoke': require('./invoke'), | ||
'keys': require('./keys'), | ||
'keysIn': require('./keysIn'), | ||
'mapKeys': require('./mapKeys'), | ||
'mapValues': require('./mapValues'), | ||
'merge': require('./merge'), | ||
'mergeWith': require('./mergeWith'), | ||
'omit': require('./omit'), | ||
'omitBy': require('./omitBy'), | ||
'pick': require('./pick'), | ||
'pickBy': require('./pickBy'), | ||
'result': require('./result'), | ||
'set': require('./set'), | ||
'setWith': require('./setWith'), | ||
'toPairs': require('./toPairs'), | ||
'toPairsIn': require('./toPairsIn'), | ||
'transform': require('./transform'), | ||
'unset': require('./unset'), | ||
'values': require('./values'), | ||
'valuesIn': require('./valuesIn') | ||
}; |
{ | ||
"name": "lodash", | ||
"version": "3.10.1", | ||
"description": "The modern build of lodash modular utilities.", | ||
"version": "4.0.0", | ||
"description": "Lodash modular utilities.", | ||
"homepage": "https://lodash.com/", | ||
@@ -13,5 +13,3 @@ "icon": "https://lodash.com/icon.svg", | ||
"John-David Dalton <john.david.dalton@gmail.com> (http://allyoucanleet.com/)", | ||
"Benjamin Tan <demoneaux@gmail.com> (https://d10.github.io/)", | ||
"Blaine Bublitz <blaine@iceddev.com> (http://www.iceddev.com/)", | ||
"Kit Cambridge <github@kitcambridge.be> (http://kitcambridge.be/)", | ||
"Blaine Bublitz <blaine.bublitz@gmail.com> (https://github.com/phated)", | ||
"Mathias Bynens <mathias@qiwi.be> (https://mathiasbynens.be/)" | ||
@@ -18,0 +16,0 @@ ], |
@@ -1,9 +0,9 @@ | ||
# lodash v3.10.1 | ||
# lodash v4.0.0 | ||
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. | ||
The [lodash](https://lodash.com/) library exported as [Node.js](https://nodejs.org/) modules. | ||
Generated using [lodash-cli](https://www.npmjs.com/package/lodash-cli): | ||
```bash | ||
$ lodash modularize modern exports=node -o ./ | ||
$ lodash modern -d -o ./index.js | ||
$ lodash modularize exports=node -o ./ | ||
$ lodash -d -o ./lodash.js | ||
``` | ||
@@ -20,3 +20,3 @@ | ||
In Node.js/io.js: | ||
In Node.js: | ||
@@ -29,6 +29,6 @@ ```js | ||
// or a method (great for smaller builds with browserify/webpack) | ||
var chunk = require('lodash/array/chunk'); | ||
var chunk = require('lodash/chunk'); | ||
``` | ||
See the [package source](https://github.com/lodash/lodash/tree/3.10.1-npm) for more details. | ||
See the [package source](https://github.com/lodash/lodash/tree/4.0.0-npm) for more details. | ||
@@ -43,5 +43,5 @@ **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.10.1-amd) & [compatibility](https://github.com/lodash/lodash-compat/tree/3.10.1-amd) builds | ||
* ES modules for the [modern](https://github.com/lodash/lodash/tree/3.10.1-es) build | ||
* [lodash](https://www.npmjs.com/package/lodash) & [per method](https://www.npmjs.com/browse/keyword/lodash-modularized) packages | ||
* [lodash-amd](https://www.npmjs.com/package/lodash-amd) | ||
* [lodash-es](https://www.npmjs.com/package/lodash-es) | ||
@@ -56,70 +56,5 @@ ## Further Reading | ||
## Features | ||
* ~100% [code coverage](https://coveralls.io/r/lodash) | ||
* Follows [semantic versioning](http://semver.org/) for releases | ||
* [Lazily evaluated](http://filimanjaro.com/blog/2014/introducing-lazy-evaluation/) chaining | ||
* [_(…)](https://lodash.com/docs#_) supports implicit chaining | ||
* [_.ary](https://lodash.com/docs#ary) & [_.rearg](https://lodash.com/docs#rearg) to change function argument limits & order | ||
* [_.at](https://lodash.com/docs#at) for cherry-picking collection values | ||
* [_.attempt](https://lodash.com/docs#attempt) to execute functions which may error without a try-catch | ||
* [_.before](https://lodash.com/docs#before) to complement [_.after](https://lodash.com/docs#after) | ||
* [_.bindKey](https://lodash.com/docs#bindKey) for binding [*“lazy”*](http://michaux.ca/articles/lazy-function-definition-pattern) defined methods | ||
* [_.chunk](https://lodash.com/docs#chunk) for splitting an array into chunks of a given size | ||
* [_.clone](https://lodash.com/docs#clone) supports shallow cloning of `Date` & `RegExp` objects | ||
* [_.cloneDeep](https://lodash.com/docs#cloneDeep) for deep cloning arrays & objects | ||
* [_.curry](https://lodash.com/docs#curry) & [_.curryRight](https://lodash.com/docs#curryRight) for creating [curried](http://hughfdjackson.com/javascript/why-curry-helps/) functions | ||
* [_.debounce](https://lodash.com/docs#debounce) & [_.throttle](https://lodash.com/docs#throttle) are cancelable & accept options for more control | ||
* [_.defaultsDeep](https://lodash.com/docs#defaultsDeep) for recursively assigning default properties | ||
* [_.fill](https://lodash.com/docs#fill) to fill arrays with values | ||
* [_.findKey](https://lodash.com/docs#findKey) for finding keys | ||
* [_.flow](https://lodash.com/docs#flow) to complement [_.flowRight](https://lodash.com/docs#flowRight) (a.k.a `_.compose`) | ||
* [_.forEach](https://lodash.com/docs#forEach) supports exiting early | ||
* [_.forIn](https://lodash.com/docs#forIn) for iterating all enumerable properties | ||
* [_.forOwn](https://lodash.com/docs#forOwn) for iterating own properties | ||
* [_.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 | ||
* [_.isNative](https://lodash.com/docs#isNative) to check for native functions | ||
* [_.isPlainObject](https://lodash.com/docs#isPlainObject) & [_.toPlainObject](https://lodash.com/docs#toPlainObject) to check for & convert to `Object` objects | ||
* [_.isTypedArray](https://lodash.com/docs#isTypedArray) to check for typed arrays | ||
* [_.mapKeys](https://lodash.com/docs#mapKeys) for mapping keys to an object | ||
* [_.matches](https://lodash.com/docs#matches) supports deep object comparisons | ||
* [_.matchesProperty](https://lodash.com/docs#matchesProperty) to complement [_.matches](https://lodash.com/docs#matches) & [_.property](https://lodash.com/docs#property) | ||
* [_.merge](https://lodash.com/docs#merge) for a deep [_.extend](https://lodash.com/docs#extend) | ||
* [_.method](https://lodash.com/docs#method) & [_.methodOf](https://lodash.com/docs#methodOf) to create functions that invoke methods | ||
* [_.modArgs](https://lodash.com/docs#modArgs) for more advanced functional composition | ||
* [_.parseInt](https://lodash.com/docs#parseInt) for consistent cross-environment behavior | ||
* [_.pull](https://lodash.com/docs#pull), [_.pullAt](https://lodash.com/docs#pullAt), & [_.remove](https://lodash.com/docs#remove) for mutating arrays | ||
* [_.random](https://lodash.com/docs#random) supports returning floating-point numbers | ||
* [_.restParam](https://lodash.com/docs#restParam) & [_.spread](https://lodash.com/docs#spread) for applying rest parameters & spreading arguments to functions | ||
* [_.runInContext](https://lodash.com/docs#runInContext) for collisionless mixins & easier mocking | ||
* [_.slice](https://lodash.com/docs#slice) for creating subsets of array-like values | ||
* [_.sortByAll](https://lodash.com/docs#sortByAll) & [_.sortByOrder](https://lodash.com/docs#sortByOrder) for sorting by multiple properties & orders | ||
* [_.support](https://lodash.com/docs#support) for flagging environment features | ||
* [_.template](https://lodash.com/docs#template) supports [*“imports”*](https://lodash.com/docs#templateSettings-imports) options & [ES template delimiters](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-template-literal-lexical-components) | ||
* [_.transform](https://lodash.com/docs#transform) as a powerful alternative to [_.reduce](https://lodash.com/docs#reduce) for transforming objects | ||
* [_.unzipWith](https://lodash.com/docs#unzipWith) & [_.zipWith](https://lodash.com/docs#zipWith) to specify how grouped values should be combined | ||
* [_.valuesIn](https://lodash.com/docs#valuesIn) for getting values of all enumerable properties | ||
* [_.xor](https://lodash.com/docs#xor) to complement [_.difference](https://lodash.com/docs#difference), [_.intersection](https://lodash.com/docs#intersection), & [_.union](https://lodash.com/docs#union) | ||
* [_.add](https://lodash.com/docs#add), [_.round](https://lodash.com/docs#round), [_.sum](https://lodash.com/docs#sum), & | ||
[more](https://lodash.com/docs "_.ceil & _.floor") math methods | ||
* [_.bind](https://lodash.com/docs#bind), [_.curry](https://lodash.com/docs#curry), [_.partial](https://lodash.com/docs#partial), & | ||
[more](https://lodash.com/docs "_.bindKey, _.curryRight, _.partialRight") support customizable argument placeholders | ||
* [_.capitalize](https://lodash.com/docs#capitalize), [_.trim](https://lodash.com/docs#trim), & | ||
[more](https://lodash.com/docs "_.camelCase, _.deburr, _.endsWith, _.escapeRegExp, _.kebabCase, _.pad, _.padLeft, _.padRight, _.repeat, _.snakeCase, _.startCase, _.startsWith, _.trimLeft, _.trimRight, _.trunc, _.words") string methods | ||
* [_.clone](https://lodash.com/docs#clone), [_.isEqual](https://lodash.com/docs#isEqual), & | ||
[more](https://lodash.com/docs "_.assign, _.cloneDeep, _.merge") accept customizer callbacks | ||
* [_.dropWhile](https://lodash.com/docs#dropWhile), [_.takeWhile](https://lodash.com/docs#takeWhile), & | ||
[more](https://lodash.com/docs "_.drop, _.dropRight, _.dropRightWhile, _.take, _.takeRight, _.takeRightWhile") to complement [_.first](https://lodash.com/docs#first), [_.initial](https://lodash.com/docs#initial), [_.last](https://lodash.com/docs#last), & [_.rest](https://lodash.com/docs#rest) | ||
* [_.findLast](https://lodash.com/docs#findLast), [_.findLastKey](https://lodash.com/docs#findLastKey), & | ||
[more](https://lodash.com/docs "_.curryRight, _.dropRight, _.dropRightWhile, _.flowRight, _.forEachRight, _.forInRight, _.forOwnRight, _.padRight, partialRight, _.takeRight, _.trimRight, _.takeRightWhile") right-associative methods | ||
* [_.includes](https://lodash.com/docs#includes), [_.toArray](https://lodash.com/docs#toArray), & | ||
[more](https://lodash.com/docs "_.at, _.countBy, _.every, _.filter, _.find, _.findLast, _.findWhere, _.forEach, _.forEachRight, _.groupBy, _.indexBy, _.invoke, _.map, _.max, _.min, _.partition, _.pluck, _.reduce, _.reduceRight, _.reject, _.shuffle, _.size, _.some, _.sortBy, _.sortByAll, _.sortByOrder, _.sum, _.where") accept strings | ||
* [_#commit](https://lodash.com/docs#prototype-commit) & [_#plant](https://lodash.com/docs#prototype-plant) for working with chain sequences | ||
* [_#thru](https://lodash.com/docs#thru) to pass values thru a chain sequence | ||
## Support | ||
Tested in Chrome 43-44, Firefox 38-39, IE 6-11, MS Edge, Safari 5-8, ChakraNode 0.12.2, io.js 2.5.0, Node.js 0.8.28, 0.10.40, & 0.12.7, PhantomJS 1.9.8, RingoJS 0.11, & Rhino 1.7.6. | ||
Tested in Chrome 46-47, Firefox 42-43, IE 9-11, Edge 13, Safari 8-9, Node.js 0.10.x, 0.12.x, 4.x, & 5.x, & PhantomJS 1.9.8. | ||
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. |
module.exports = { | ||
'camelCase': require('./string/camelCase'), | ||
'capitalize': require('./string/capitalize'), | ||
'deburr': require('./string/deburr'), | ||
'endsWith': require('./string/endsWith'), | ||
'escape': require('./string/escape'), | ||
'escapeRegExp': require('./string/escapeRegExp'), | ||
'kebabCase': require('./string/kebabCase'), | ||
'pad': require('./string/pad'), | ||
'padLeft': require('./string/padLeft'), | ||
'padRight': require('./string/padRight'), | ||
'parseInt': require('./string/parseInt'), | ||
'repeat': require('./string/repeat'), | ||
'snakeCase': require('./string/snakeCase'), | ||
'startCase': require('./string/startCase'), | ||
'startsWith': require('./string/startsWith'), | ||
'template': require('./string/template'), | ||
'templateSettings': require('./string/templateSettings'), | ||
'trim': require('./string/trim'), | ||
'trimLeft': require('./string/trimLeft'), | ||
'trimRight': require('./string/trimRight'), | ||
'trunc': require('./string/trunc'), | ||
'unescape': require('./string/unescape'), | ||
'words': require('./string/words') | ||
'camelCase': require('./camelCase'), | ||
'capitalize': require('./capitalize'), | ||
'deburr': require('./deburr'), | ||
'endsWith': require('./endsWith'), | ||
'escape': require('./escape'), | ||
'escapeRegExp': require('./escapeRegExp'), | ||
'kebabCase': require('./kebabCase'), | ||
'lowerCase': require('./lowerCase'), | ||
'lowerFirst': require('./lowerFirst'), | ||
'pad': require('./pad'), | ||
'padEnd': require('./padEnd'), | ||
'padStart': require('./padStart'), | ||
'parseInt': require('./parseInt'), | ||
'repeat': require('./repeat'), | ||
'replace': require('./replace'), | ||
'snakeCase': require('./snakeCase'), | ||
'split': require('./split'), | ||
'startCase': require('./startCase'), | ||
'startsWith': require('./startsWith'), | ||
'template': require('./template'), | ||
'templateSettings': require('./templateSettings'), | ||
'toLower': require('./toLower'), | ||
'toUpper': require('./toUpper'), | ||
'trim': require('./trim'), | ||
'trimEnd': require('./trimEnd'), | ||
'trimStart': require('./trimStart'), | ||
'truncate': require('./truncate'), | ||
'unescape': require('./unescape'), | ||
'upperCase': require('./upperCase'), | ||
'upperFirst': require('./upperFirst'), | ||
'words': require('./words') | ||
}; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
952201
520
29042
57
2