lodash
Advanced tools
Comparing version 4.0.0 to 4.0.1
@@ -32,3 +32,3 @@ var copyObjectWith = require('./internal/copyObjectWith'), | ||
*/ | ||
var assignInWith = createAssigner(function(object, source, customizer) { | ||
var assignInWith = createAssigner(function(object, source, srcIndex, customizer) { | ||
copyObjectWith(source, keysIn(source), object, customizer); | ||
@@ -35,0 +35,0 @@ }); |
@@ -31,3 +31,3 @@ var copyObjectWith = require('./internal/copyObjectWith'), | ||
*/ | ||
var assignWith = createAssigner(function(object, source, customizer) { | ||
var assignWith = createAssigner(function(object, source, srcIndex, customizer) { | ||
copyObjectWith(source, keys(source), object, customizer); | ||
@@ -34,0 +34,0 @@ }); |
@@ -20,3 +20,3 @@ var baseClone = require('./internal/baseClone'); | ||
* | ||
* var el = _.cloneDeep(document.body, customizer); | ||
* var el = _.cloneDeepWith(document.body, customizer); | ||
* | ||
@@ -23,0 +23,0 @@ * console.log(el === document.body); |
@@ -7,3 +7,3 @@ var baseClone = require('./internal/baseClone'); | ||
* cloning is handled by the method instead. The `customizer` is invoked with | ||
* up to five arguments; (value [, index|key, object, stack]). | ||
* up to four arguments; (value [, index|key, object, stack]). | ||
* | ||
@@ -24,3 +24,3 @@ * @static | ||
* | ||
* var el = _.clone(document.body, customizer); | ||
* var el = _.cloneWith(document.body, customizer); | ||
* | ||
@@ -27,0 +27,0 @@ * console.log(el === document.body); |
@@ -28,6 +28,9 @@ var arrayConcat = require('./internal/arrayConcat'), | ||
var concat = rest(function(array, values) { | ||
if (!isArray(array)) { | ||
array = array == null ? [] : [Object(array)]; | ||
} | ||
values = baseFlatten(values); | ||
return arrayConcat(isArray(array) ? array : [Object(array)], values); | ||
return arrayConcat(array, values); | ||
}); | ||
module.exports = concat; |
@@ -26,3 +26,3 @@ var apply = require('./internal/apply'), | ||
* [_.constant(true), _.constant('no match')] | ||
* ]) | ||
* ]); | ||
* | ||
@@ -29,0 +29,0 @@ * func({ 'a': 1, 'b': 2 }); |
@@ -19,3 +19,3 @@ var createAggregator = require('./internal/createAggregator'); | ||
* @param {Array|Object} collection The collection to iterate over. | ||
* @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. | ||
* @param {Function|Object|string} [iteratee=_.identity] The iteratee to transform keys. | ||
* @returns {Object} Returns the composed aggregate object. | ||
@@ -22,0 +22,0 @@ * @example |
@@ -8,8 +8,12 @@ var deburrLetter = require('./internal/deburrLetter'), | ||
/** Used to compose unicode character classes. */ | ||
var rsComboRange = '\\u0300-\\u036f\\ufe20-\\ufe23'; | ||
var rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23', | ||
rsComboSymbolsRange = '\\u20d0-\\u20f0'; | ||
/** Used to compose unicode capture groups. */ | ||
var rsCombo = '[' + rsComboRange + ']'; | ||
var rsCombo = '[' + rsComboMarksRange + rsComboSymbolsRange + ']'; | ||
/** Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks). */ | ||
/** | ||
* Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and | ||
* [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols). | ||
*/ | ||
var reComboMark = RegExp(rsCombo, 'g'); | ||
@@ -16,0 +20,0 @@ |
@@ -1,1 +0,2 @@ | ||
module.exports = require('./fp/convert.js')(); | ||
var _ = require('./lodash').noConflict().runInContext(); | ||
module.exports = require('./fp/convert')(_); |
@@ -1,18 +0,13 @@ | ||
var _ = require('../lodash'), | ||
baseConvert = require('./baseConvert.js'), | ||
util = require('./util.js'); | ||
var baseConvert = require('./_baseConvert'), | ||
util = require('./_util'); | ||
/** | ||
* Converts `func` of `name` to an auto-curried iteratee-first data-last version. | ||
* If `name` is an object, the methods on it will be converted and the object returned. | ||
* Converts `func` of `name` to an immutable auto-curried iteratee-first data-last | ||
* version. If `name` is an object its methods will be converted. | ||
* | ||
* @param {string} [name] The name of the function to wrap. | ||
* @param {string} name The name of the function to wrap. | ||
* @param {Function} [func] The function to wrap. | ||
* @returns {Function|Object} Returns the converted function or object. | ||
*/ | ||
function convert() { | ||
var args = arguments, | ||
name = args.length ? args[0] : _.noConflict().runInContext(), | ||
func = args[1]; | ||
function convert(name, func) { | ||
return baseConvert(util, name, func); | ||
@@ -19,0 +14,0 @@ } |
@@ -1,3 +0,1 @@ | ||
var baseSet = require('./internal/baseSet'); | ||
/** | ||
@@ -24,3 +22,3 @@ * The inverse of `_.toPairs`; this method returns an object composed | ||
var pair = pairs[index]; | ||
baseSet(result, pair[0], pair[1]); | ||
result[pair[0]] = pair[1]; | ||
} | ||
@@ -27,0 +25,0 @@ return result; |
@@ -12,3 +12,3 @@ var createAggregator = require('./internal/createAggregator'); | ||
* each element of `collection` through `iteratee`. The corresponding value | ||
* of each key is an array of the elements responsible for generating the key. | ||
* of each key is an array of elements responsible for generating the key. | ||
* The iteratee is invoked with one argument: (value). | ||
@@ -20,3 +20,3 @@ * | ||
* @param {Array|Object} collection The collection to iterate over. | ||
* @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. | ||
* @param {Function|Object|string} [iteratee=_.identity] The iteratee to transform keys. | ||
* @returns {Object} Returns the composed aggregate object. | ||
@@ -23,0 +23,0 @@ * @example |
@@ -9,10 +9,10 @@ /** | ||
* @param {*} [accumulator] The initial value. | ||
* @param {boolean} [initFromArray] Specify using the first element of `array` as the initial value. | ||
* @param {boolean} [initAccum] Specify using the first element of `array` as the initial value. | ||
* @returns {*} Returns the accumulated value. | ||
*/ | ||
function arrayReduce(array, iteratee, accumulator, initFromArray) { | ||
function arrayReduce(array, iteratee, accumulator, initAccum) { | ||
var index = -1, | ||
length = array.length; | ||
if (initFromArray && length) { | ||
if (initAccum && length) { | ||
accumulator = array[++index]; | ||
@@ -19,0 +19,0 @@ } |
@@ -9,8 +9,8 @@ /** | ||
* @param {*} [accumulator] The initial value. | ||
* @param {boolean} [initFromArray] Specify using the last element of `array` as the initial value. | ||
* @param {boolean} [initAccum] Specify using the last element of `array` as the initial value. | ||
* @returns {*} Returns the accumulated value. | ||
*/ | ||
function arrayReduceRight(array, iteratee, accumulator, initFromArray) { | ||
function arrayReduceRight(array, iteratee, accumulator, initAccum) { | ||
var length = array.length; | ||
if (initFromArray && length) { | ||
if (initAccum && length) { | ||
accumulator = array[--length]; | ||
@@ -17,0 +17,0 @@ } |
/** | ||
* The base implementation of methods like `_.find` and `_.findKey`, without | ||
* support for iteratee shorthands, which iterates over `collection` using | ||
* the provided `eachFunc`. | ||
* `eachFunc`. | ||
* | ||
@@ -6,0 +6,0 @@ * @private |
@@ -11,3 +11,2 @@ var apply = require('./apply'), | ||
* | ||
* | ||
* @private | ||
@@ -14,0 +13,0 @@ * @param {Object} object The object to query. |
@@ -50,3 +50,6 @@ var Stack = require('./Stack'), | ||
if (!(result === undefined ? baseIsEqual(srcValue, objValue, customizer, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG, stack) : result)) { | ||
if (!(result === undefined | ||
? baseIsEqual(srcValue, objValue, customizer, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG, stack) | ||
: result | ||
)) { | ||
return false; | ||
@@ -53,0 +56,0 @@ } |
@@ -16,6 +16,7 @@ var Stack = require('./Stack'), | ||
* @param {Object} source The source object. | ||
* @param {number} srcIndex The index of `source`. | ||
* @param {Function} [customizer] The function to customize merged values. | ||
* @param {Object} [stack] Tracks traversed source values and their merged counterparts. | ||
*/ | ||
function baseMerge(object, source, customizer, stack) { | ||
function baseMerge(object, source, srcIndex, customizer, stack) { | ||
if (object === source) { | ||
@@ -32,3 +33,3 @@ return; | ||
stack || (stack = new Stack); | ||
baseMergeDeep(object, source, key, baseMerge, customizer, stack); | ||
baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack); | ||
} | ||
@@ -35,0 +36,0 @@ else { |
@@ -22,2 +22,3 @@ var assignMergeValue = require('./assignMergeValue'), | ||
* @param {string} key The key of the value to merge. | ||
* @param {number} srcIndex The index of `source`. | ||
* @param {Function} mergeFunc The function to merge values. | ||
@@ -27,3 +28,3 @@ * @param {Function} [customizer] The function to customize assigned values. | ||
*/ | ||
function baseMergeDeep(object, source, key, mergeFunc, customizer, stack) { | ||
function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) { | ||
var objValue = object[key], | ||
@@ -43,13 +44,25 @@ srcValue = source[key], | ||
if (isArray(srcValue) || isTypedArray(srcValue)) { | ||
newValue = isArray(objValue) | ||
? objValue | ||
: ((isArrayLikeObject(objValue)) ? copyArray(objValue) : baseClone(srcValue)); | ||
if (isArray(objValue)) { | ||
newValue = srcIndex ? copyArray(objValue) : objValue; | ||
} | ||
else if (isArrayLikeObject(objValue)) { | ||
newValue = copyArray(objValue); | ||
} | ||
else { | ||
newValue = baseClone(srcValue); | ||
} | ||
} | ||
else if (isPlainObject(srcValue) || isArguments(srcValue)) { | ||
newValue = isArguments(objValue) | ||
? toPlainObject(objValue) | ||
: (isObject(objValue) ? objValue : baseClone(srcValue)); | ||
if (isArguments(objValue)) { | ||
newValue = toPlainObject(objValue); | ||
} | ||
else if (!isObject(objValue) || (srcIndex && isFunction(objValue))) { | ||
newValue = baseClone(srcValue); | ||
} | ||
else { | ||
newValue = srcIndex ? baseClone(objValue) : objValue; | ||
} | ||
} | ||
else { | ||
isCommon = isFunction(srcValue); | ||
isCommon = false; | ||
} | ||
@@ -61,3 +74,3 @@ } | ||
// Recursively merge objects and arrays (susceptible to call stack limits). | ||
mergeFunc(newValue, srcValue, customizer, stack); | ||
mergeFunc(newValue, srcValue, srcIndex, customizer, stack); | ||
} | ||
@@ -64,0 +77,0 @@ assignMergeValue(object, key, newValue); |
@@ -14,3 +14,3 @@ var baseForIn = require('./baseForIn'); | ||
baseForIn(object, function(value, key) { | ||
if (predicate(value)) { | ||
if (predicate(value, key)) { | ||
result[key] = value; | ||
@@ -17,0 +17,0 @@ } |
/** | ||
* The base implementation of `_.reduce` and `_.reduceRight`, without support | ||
* for iteratee shorthands, which iterates over `collection` using the provided | ||
* `eachFunc`. | ||
* for iteratee shorthands, which iterates over `collection` using `eachFunc`. | ||
* | ||
@@ -10,10 +9,10 @@ * @private | ||
* @param {*} accumulator The initial value. | ||
* @param {boolean} initFromCollection Specify using the first or last element of `collection` as the initial value. | ||
* @param {boolean} initAccum Specify using the first or last element of `collection` as the initial value. | ||
* @param {Function} eachFunc The function to iterate over `collection`. | ||
* @returns {*} Returns the accumulated value. | ||
*/ | ||
function baseReduce(collection, iteratee, accumulator, initFromCollection, eachFunc) { | ||
function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) { | ||
eachFunc(collection, function(value, index, collection) { | ||
accumulator = initFromCollection | ||
? (initFromCollection = false, value) | ||
accumulator = initAccum | ||
? (initAccum = false, value) | ||
: iteratee(accumulator, value, index, collection); | ||
@@ -20,0 +19,0 @@ }); |
@@ -1,6 +0,6 @@ | ||
var _Symbol = require('./_Symbol'); | ||
var Symbol = require('./Symbol'); | ||
/** Used to convert symbols to primitives and strings. */ | ||
var symbolProto = _Symbol ? _Symbol.prototype : undefined, | ||
symbolValueOf = _Symbol ? symbolProto.valueOf : undefined; | ||
var symbolProto = Symbol ? Symbol.prototype : undefined, | ||
symbolValueOf = Symbol ? symbolProto.valueOf : undefined; | ||
@@ -15,5 +15,5 @@ /** | ||
function cloneSymbol(symbol) { | ||
return _Symbol ? Object(symbolValueOf.call(symbol)) : {}; | ||
return Symbol ? Object(symbolValueOf.call(symbol)) : {}; | ||
} | ||
module.exports = cloneSymbol; |
@@ -27,3 +27,3 @@ var isIterateeCall = require('./isIterateeCall'), | ||
if (source) { | ||
assigner(object, source, customizer); | ||
assigner(object, source, index, customizer); | ||
} | ||
@@ -30,0 +30,0 @@ } |
@@ -6,3 +6,4 @@ var stringToArray = require('./stringToArray'), | ||
var rsAstralRange = '\\ud800-\\udfff', | ||
rsComboRange = '\\u0300-\\u036f\\ufe20-\\ufe23', | ||
rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23', | ||
rsComboSymbolsRange = '\\u20d0-\\u20f0', | ||
rsVarRange = '\\ufe0e\\ufe0f'; | ||
@@ -14,3 +15,3 @@ | ||
/** 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 + ']'); | ||
var reHasComplexSymbol = RegExp('[' + rsZWJ + rsAstralRange + rsComboMarksRange + rsComboSymbolsRange + rsVarRange + ']'); | ||
@@ -17,0 +18,0 @@ /** |
@@ -8,3 +8,4 @@ var repeat = require('../repeat'), | ||
var rsAstralRange = '\\ud800-\\udfff', | ||
rsComboRange = '\\u0300-\\u036f\\ufe20-\\ufe23', | ||
rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23', | ||
rsComboSymbolsRange = '\\u20d0-\\u20f0', | ||
rsVarRange = '\\ufe0e\\ufe0f'; | ||
@@ -16,3 +17,3 @@ | ||
/** 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 + ']'); | ||
var reHasComplexSymbol = RegExp('[' + rsZWJ + rsAstralRange + rsComboMarksRange + rsComboSymbolsRange + rsVarRange + ']'); | ||
@@ -19,0 +20,0 @@ /* Built-in method references for those with the same name as other `lodash` methods. */ |
@@ -1,3 +0,3 @@ | ||
var Uint8Array = require('./Uint8Array'), | ||
_Symbol = require('./_Symbol'), | ||
var Symbol = require('./Symbol'), | ||
Uint8Array = require('./Uint8Array'), | ||
mapToArray = require('./mapToArray'), | ||
@@ -24,4 +24,4 @@ setToArray = require('./setToArray'); | ||
/** Used to convert symbols to primitives and strings. */ | ||
var symbolProto = _Symbol ? _Symbol.prototype : undefined, | ||
symbolValueOf = _Symbol ? symbolProto.valueOf : undefined; | ||
var symbolProto = Symbol ? Symbol.prototype : undefined, | ||
symbolValueOf = Symbol ? symbolProto.valueOf : undefined; | ||
@@ -84,3 +84,3 @@ /** | ||
case symbolTag: | ||
return !!_Symbol && (symbolValueOf.call(object) == symbolValueOf.call(other)); | ||
return !!Symbol && (symbolValueOf.call(object) == symbolValueOf.call(other)); | ||
} | ||
@@ -87,0 +87,0 @@ return false; |
@@ -5,4 +5,3 @@ var baseHas = require('./baseHas'), | ||
/** Used to compose bitmasks for comparison styles. */ | ||
var UNORDERED_COMPARE_FLAG = 1, | ||
PARTIAL_COMPARE_FLAG = 2; | ||
var PARTIAL_COMPARE_FLAG = 2; | ||
@@ -24,3 +23,2 @@ /** | ||
var isPartial = bitmask & PARTIAL_COMPARE_FLAG, | ||
isUnordered = bitmask & UNORDERED_COMPARE_FLAG, | ||
objProps = keys(object), | ||
@@ -37,4 +35,3 @@ objLength = objProps.length, | ||
var key = objProps[index]; | ||
if (!(isPartial ? key in other : baseHas(other, key)) || | ||
!(isUnordered || key == othProps[index])) { | ||
if (!(isPartial ? key in other : baseHas(other, key))) { | ||
return false; | ||
@@ -41,0 +38,0 @@ } |
var realNames = require('./realNames'); | ||
/** Used for built-in method references. */ | ||
var objectProto = global.Object.prototype; | ||
/** Used to check objects for own properties. */ | ||
var hasOwnProperty = objectProto.hasOwnProperty; | ||
/** | ||
@@ -13,3 +19,3 @@ * Gets the name of `func`. | ||
array = realNames[result], | ||
length = array ? array.length : 0; | ||
length = hasOwnProperty.call(realNames, result) ? array.length : 0; | ||
@@ -16,0 +22,0 @@ while (length--) { |
@@ -1,3 +0,2 @@ | ||
var baseClone = require('./baseClone'), | ||
baseMerge = require('./baseMerge'), | ||
var baseMerge = require('./baseMerge'), | ||
isObject = require('../isObject'); | ||
@@ -20,7 +19,7 @@ | ||
stack.set(srcValue, objValue); | ||
baseMerge(objValue, srcValue, mergeDefaults, stack); | ||
baseMerge(objValue, srcValue, undefined, mergeDefaults, stack); | ||
} | ||
return objValue === undefined ? baseClone(srcValue) : objValue; | ||
return objValue; | ||
} | ||
module.exports = mergeDefaults; |
/** Used to compose unicode character classes. */ | ||
var rsAstralRange = '\\ud800-\\udfff', | ||
rsComboRange = '\\u0300-\\u036f\\ufe20-\\ufe23', | ||
rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23', | ||
rsComboSymbolsRange = '\\u20d0-\\u20f0', | ||
rsVarRange = '\\ufe0e\\ufe0f'; | ||
@@ -8,4 +9,5 @@ | ||
var rsAstral = '[' + rsAstralRange + ']', | ||
rsCombo = '[' + rsComboRange + ']', | ||
rsModifier = '(?:\\ud83c[\\udffb-\\udfff])', | ||
rsCombo = '[' + rsComboMarksRange + rsComboSymbolsRange + ']', | ||
rsFitz = '\\ud83c[\\udffb-\\udfff]', | ||
rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')', | ||
rsNonAstral = '[^' + rsAstralRange + ']', | ||
@@ -24,6 +26,6 @@ rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}', | ||
/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */ | ||
var reComplexSymbol = RegExp(rsSymbol + rsSeq, 'g'); | ||
var reComplexSymbol = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g'); | ||
/** 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 + ']'); | ||
var reHasComplexSymbol = RegExp('[' + rsZWJ + rsAstralRange + rsComboMarksRange + rsComboSymbolsRange + rsVarRange + ']'); | ||
@@ -33,2 +35,3 @@ /** | ||
* | ||
* @private | ||
* @param {string} string The string to inspect. | ||
@@ -35,0 +38,0 @@ * @returns {number} Returns the string size. |
/** Used to compose unicode character classes. */ | ||
var rsAstralRange = '\\ud800-\\udfff', | ||
rsComboRange = '\\u0300-\\u036f\\ufe20-\\ufe23', | ||
rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23', | ||
rsComboSymbolsRange = '\\u20d0-\\u20f0', | ||
rsVarRange = '\\ufe0e\\ufe0f'; | ||
@@ -8,4 +9,5 @@ | ||
var rsAstral = '[' + rsAstralRange + ']', | ||
rsCombo = '[' + rsComboRange + ']', | ||
rsModifier = '(?:\\ud83c[\\udffb-\\udfff])', | ||
rsCombo = '[' + rsComboMarksRange + rsComboSymbolsRange + ']', | ||
rsFitz = '\\ud83c[\\udffb-\\udfff]', | ||
rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')', | ||
rsNonAstral = '[^' + rsAstralRange + ']', | ||
@@ -24,3 +26,3 @@ rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}', | ||
/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */ | ||
var reComplexSymbol = RegExp(rsSymbol + rsSeq, 'g'); | ||
var reComplexSymbol = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g'); | ||
@@ -27,0 +29,0 @@ /** |
@@ -17,2 +17,3 @@ var arrayMap = require('./internal/arrayMap'), | ||
* @example | ||
* | ||
* _.intersection([2, 1], [4, 2], [1, 2]); | ||
@@ -19,0 +20,0 @@ * // => [2] |
@@ -6,3 +6,3 @@ var baseIsEqual = require('./internal/baseIsEqual'); | ||
* invoked to compare values. If `customizer` returns `undefined` comparisons are | ||
* handled by the method instead. The `customizer` is invoked with up to seven arguments: | ||
* handled by the method instead. The `customizer` is invoked with up to six arguments: | ||
* (objValue, othValue [, index|key, object, other, stack]). | ||
@@ -9,0 +9,0 @@ * |
@@ -7,3 +7,3 @@ var baseIsMatch = require('./internal/baseIsMatch'), | ||
* is invoked to compare values. If `customizer` returns `undefined` comparisons | ||
* are handled by the method instead. The `customizer` is invoked with three | ||
* are handled by the method instead. The `customizer` is invoked with five | ||
* arguments: (objValue, srcValue, index|key, object, source). | ||
@@ -10,0 +10,0 @@ * |
@@ -13,3 +13,3 @@ var createAggregator = require('./internal/createAggregator'); | ||
* @param {Array|Object} collection The collection to iterate over. | ||
* @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element. | ||
* @param {Function|Object|string} [iteratee=_.identity] The iteratee to transform keys. | ||
* @returns {Object} Returns the composed aggregate object. | ||
@@ -23,5 +23,2 @@ * @example | ||
* | ||
* _.keyBy(keyData, 'dir'); | ||
* // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } } | ||
* | ||
* _.keyBy(keyData, function(o) { | ||
@@ -31,2 +28,5 @@ * return String.fromCharCode(o.code); | ||
* // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } } | ||
* | ||
* _.keyBy(keyData, 'dir'); | ||
* // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } } | ||
*/ | ||
@@ -33,0 +33,0 @@ var keyBy = createAggregator(function(result, value, key) { |
@@ -32,7 +32,7 @@ var arrayMap = require('./internal/arrayMap'), | ||
* | ||
* _.map([1, 2], square); | ||
* // => [3, 6] | ||
* _.map([4, 8], square); | ||
* // => [16, 64] | ||
* | ||
* _.map({ 'a': 1, 'b': 2 }, square); | ||
* // => [3, 6] (iteration order is not guaranteed) | ||
* _.map({ 'a': 4, 'b': 8 }, square); | ||
* // => [16, 64] (iteration order is not guaranteed) | ||
* | ||
@@ -39,0 +39,0 @@ * var users = [ |
@@ -20,3 +20,3 @@ var baseExtremum = require('./internal/baseExtremum'), | ||
* | ||
* _.maxBy(objects, function(o) { return o.a; }); | ||
* _.maxBy(objects, function(o) { return o.n; }); | ||
* // => { 'n': 2 } | ||
@@ -23,0 +23,0 @@ * |
@@ -33,6 +33,6 @@ var baseMerge = require('./internal/baseMerge'), | ||
*/ | ||
var merge = createAssigner(function(object, source) { | ||
baseMerge(object, source); | ||
var merge = createAssigner(function(object, source, srcIndex) { | ||
baseMerge(object, source, srcIndex); | ||
}); | ||
module.exports = merge; |
@@ -39,6 +39,6 @@ var baseMerge = require('./internal/baseMerge'), | ||
*/ | ||
var mergeWith = createAssigner(function(object, source, customizer) { | ||
baseMerge(object, source, customizer); | ||
var mergeWith = createAssigner(function(object, source, srcIndex, customizer) { | ||
baseMerge(object, source, srcIndex, customizer); | ||
}); | ||
module.exports = mergeWith; |
@@ -20,3 +20,3 @@ var baseExtremum = require('./internal/baseExtremum'), | ||
* | ||
* _.minBy(objects, function(o) { return o.a; }); | ||
* _.minBy(objects, function(o) { return o.n; }); | ||
* // => { 'n': 1 } | ||
@@ -23,0 +23,0 @@ * |
@@ -9,2 +9,4 @@ module.exports = { | ||
'defaultsDeep': require('./defaultsDeep'), | ||
'extend': require('./extend'), | ||
'extendWith': require('./extendWith'), | ||
'findKey': require('./findKey'), | ||
@@ -11,0 +13,0 @@ 'findLastKey': require('./findLastKey'), |
@@ -23,5 +23,5 @@ var baseIteratee = require('./internal/baseIteratee'), | ||
function omitBy(object, predicate) { | ||
predicate = baseIteratee(predicate); | ||
return basePickBy(object, function(value) { | ||
return !predicate(value); | ||
predicate = baseIteratee(predicate, 2); | ||
return basePickBy(object, function(value, key) { | ||
return !predicate(value, key); | ||
}); | ||
@@ -28,0 +28,0 @@ } |
{ | ||
"name": "lodash", | ||
"version": "4.0.0", | ||
"version": "4.0.1", | ||
"description": "Lodash modular utilities.", | ||
@@ -8,3 +8,3 @@ "homepage": "https://lodash.com/", | ||
"license": "MIT", | ||
"main": "index.js", | ||
"main": "lodash.js", | ||
"keywords": "modules, stdlib, util", | ||
@@ -11,0 +11,0 @@ "author": "John-David Dalton <john.david.dalton@gmail.com> (http://allyoucanleet.com/)", |
@@ -17,3 +17,3 @@ var toString = require('./toString'); | ||
* | ||
* **Note:** This method aligns with the [ES5 implementation](https://es5.github.io/#E) | ||
* **Note:** This method aligns with the [ES5 implementation](https://es5.github.io/#x15.1.2.2) | ||
* of `parseInt`. | ||
@@ -20,0 +20,0 @@ * |
@@ -5,5 +5,5 @@ var createAggregator = require('./internal/createAggregator'); | ||
* Creates an array of elements split into two groups, the first of which | ||
* contains elements `predicate` returns truthy for, while the second of which | ||
* contains elements `predicate` returns falsey for. The predicate is invoked | ||
* with three arguments: (value, index|key, collection). | ||
* contains elements `predicate` returns truthy for, the second of which | ||
* contains elements `predicate` returns falsey for. The predicate is | ||
* invoked with one argument: (value). | ||
* | ||
@@ -10,0 +10,0 @@ * @static |
@@ -22,5 +22,5 @@ var baseIteratee = require('./internal/baseIteratee'), | ||
function pickBy(object, predicate) { | ||
return object == null ? {} : basePickBy(object, baseIteratee(predicate)); | ||
return object == null ? {} : basePickBy(object, baseIteratee(predicate, 2)); | ||
} | ||
module.exports = pickBy; |
@@ -18,3 +18,3 @@ var basePullAll = require('./internal/basePullAll'); | ||
* | ||
* _.pull(array, [2, 3]); | ||
* _.pullAll(array, [2, 3]); | ||
* console.log(array); | ||
@@ -21,0 +21,0 @@ * // => [1, 1] |
@@ -7,4 +7,3 @@ var createRange = require('./internal/createRange'); | ||
* `start` is specified without an `end` or `step`. If `end` is not specified | ||
* it's set to `start` with `start` then set to `0`. If `end` is less than | ||
* `start` a zero-length range is created unless a negative `step` is specified. | ||
* it's set to `start` with `start` then set to `0`. | ||
* | ||
@@ -11,0 +10,0 @@ * **Note:** JavaScript follows the IEEE-754 standard for resolving |
@@ -1,2 +0,2 @@ | ||
# lodash v4.0.0 | ||
# lodash v4.0.1 | ||
@@ -14,3 +14,2 @@ The [lodash](https://lodash.com/) library exported as [Node.js](https://nodejs.org/) modules. | ||
Using npm: | ||
```bash | ||
@@ -22,6 +21,9 @@ $ {sudo -H} npm i -g npm | ||
In Node.js: | ||
```js | ||
// load the modern build | ||
// load the full build | ||
var _ = require('lodash'); | ||
// load the core build | ||
var _ = require('lodash/core'); | ||
// load the fp build | ||
var _ = require('lodash/fp'); | ||
// or a method category | ||
@@ -33,3 +35,3 @@ var array = require('lodash/array'); | ||
See the [package source](https://github.com/lodash/lodash/tree/4.0.0-npm) for more details. | ||
See the [package source](https://github.com/lodash/lodash/tree/4.0.1-npm) for more details. | ||
@@ -42,3 +44,3 @@ **Note:**<br> | ||
lodash is also available in a variety of other builds & module formats. | ||
Lodash is also available in a variety of other builds & module formats. | ||
@@ -59,3 +61,3 @@ * [lodash](https://www.npmjs.com/package/lodash) & [per method](https://www.npmjs.com/browse/keyword/lodash-modularized) packages | ||
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. | ||
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. |
@@ -44,7 +44,7 @@ var arrayReduce = require('./internal/arrayReduce'), | ||
var func = isArray(collection) ? arrayReduce : baseReduce, | ||
initFromCollection = arguments.length < 3; | ||
initAccum = arguments.length < 3; | ||
return func(collection, baseIteratee(iteratee, 4), accumulator, initFromCollection, baseEach); | ||
return func(collection, baseIteratee(iteratee, 4), accumulator, initAccum, baseEach); | ||
} | ||
module.exports = reduce; |
@@ -29,7 +29,7 @@ var arrayReduceRight = require('./internal/arrayReduceRight'), | ||
var func = isArray(collection) ? arrayReduceRight : baseReduce, | ||
initFromCollection = arguments.length < 3; | ||
initAccum = arguments.length < 3; | ||
return func(collection, baseIteratee(iteratee, 4), accumulator, initFromCollection, baseEachRight); | ||
return func(collection, baseIteratee(iteratee, 4), accumulator, initAccum, baseEachRight); | ||
} | ||
module.exports = reduceRight; |
@@ -14,2 +14,3 @@ /** Used for built-in method references. */ | ||
* | ||
* @static | ||
* @memberOf _ | ||
@@ -16,0 +17,0 @@ * @category Array |
@@ -7,3 +7,4 @@ var baseClamp = require('./internal/baseClamp'), | ||
/** | ||
* Gets `n` random elements from `collection`. | ||
* Gets `n` random elements at unique keys from `collection` up to the | ||
* size of `collection`. | ||
* | ||
@@ -18,4 +19,7 @@ * @static | ||
* | ||
* _.sampleSize([1, 2, 3, 4], 2); | ||
* _.sampleSize([1, 2, 3], 2); | ||
* // => [3, 1] | ||
* | ||
* _.sampleSize([1, 2, 3], 4); | ||
* // => [2, 3, 1] | ||
*/ | ||
@@ -22,0 +26,0 @@ function sampleSize(collection, n) { |
@@ -1,2 +0,2 @@ | ||
var _Symbol = require('./internal/_Symbol'), | ||
var Symbol = require('./internal/Symbol'), | ||
copyArray = require('./internal/copyArray'), | ||
@@ -17,3 +17,3 @@ getTag = require('./internal/getTag'), | ||
/** Built-in value references. */ | ||
var iteratorSymbol = typeof (iteratorSymbol = _Symbol && _Symbol.iterator) == 'symbol' ? iteratorSymbol : undefined; | ||
var iteratorSymbol = typeof (iteratorSymbol = Symbol && Symbol.iterator) == 'symbol' ? iteratorSymbol : undefined; | ||
@@ -20,0 +20,0 @@ /** |
@@ -17,3 +17,3 @@ var baseClamp = require('./internal/baseClamp'), | ||
* @param {*} value The value to convert. | ||
* @return {number} Returns the converted integer. | ||
* @returns {number} Returns the converted integer. | ||
* @example | ||
@@ -20,0 +20,0 @@ * |
@@ -1,2 +0,2 @@ | ||
var _Symbol = require('./internal/_Symbol'), | ||
var Symbol = require('./internal/Symbol'), | ||
isSymbol = require('./isSymbol'); | ||
@@ -8,4 +8,4 @@ | ||
/** Used to convert symbols to primitives and strings. */ | ||
var symbolProto = _Symbol ? _Symbol.prototype : undefined, | ||
symbolToString = _Symbol ? symbolProto.toString : undefined; | ||
var symbolProto = Symbol ? Symbol.prototype : undefined, | ||
symbolToString = Symbol ? symbolProto.toString : undefined; | ||
@@ -41,3 +41,3 @@ /** | ||
if (isSymbol(value)) { | ||
return _Symbol ? symbolToString.call(value) : ''; | ||
return Symbol ? symbolToString.call(value) : ''; | ||
} | ||
@@ -44,0 +44,0 @@ var result = (value + ''); |
@@ -17,3 +17,4 @@ var isObject = require('./isObject'), | ||
var rsAstralRange = '\\ud800-\\udfff', | ||
rsComboRange = '\\u0300-\\u036f\\ufe20-\\ufe23', | ||
rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23', | ||
rsComboSymbolsRange = '\\u20d0-\\u20f0', | ||
rsVarRange = '\\ufe0e\\ufe0f'; | ||
@@ -25,3 +26,3 @@ | ||
/** 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 + ']'); | ||
var reHasComplexSymbol = RegExp('[' + rsZWJ + rsAstralRange + rsComboMarksRange + rsComboSymbolsRange + rsVarRange + ']'); | ||
@@ -28,0 +29,0 @@ /** |
@@ -5,2 +5,4 @@ var toString = require('./toString'); | ||
var rsAstralRange = '\\ud800-\\udfff', | ||
rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23', | ||
rsComboSymbolsRange = '\\u20d0-\\u20f0', | ||
rsDingbatRange = '\\u2700-\\u27bf', | ||
@@ -18,2 +20,3 @@ rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff', | ||
var rsBreak = '[' + rsBreakRange + ']', | ||
rsCombo = '[' + rsComboMarksRange + rsComboSymbolsRange + ']', | ||
rsDigits = '\\d+', | ||
@@ -23,3 +26,4 @@ rsDingbat = '[' + rsDingbatRange + ']', | ||
rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']', | ||
rsModifier = '(?:\\ud83c[\\udffb-\\udfff])', | ||
rsFitz = '\\ud83c[\\udffb-\\udfff]', | ||
rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')', | ||
rsNonAstral = '[^' + rsAstralRange + ']', | ||
@@ -48,3 +52,4 @@ rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}', | ||
rsUpper + '?' + rsLowerMisc + '+', | ||
rsDigits + '(?:' + rsLowerMisc + '+)?', | ||
rsUpper + '+', | ||
rsDigits, | ||
rsEmoji | ||
@@ -51,0 +56,0 @@ ].join('|'), 'g'); |
/** | ||
* This method is the wrapper version of `_.flatMap`. | ||
* | ||
* @static | ||
* @name flatMap | ||
* @memberOf _ | ||
@@ -6,0 +6,0 @@ * @category Seq |
@@ -55,9 +55,8 @@ var LazyWrapper = require('./internal/LazyWrapper'), | ||
* `at`, `before`, `bind`, `bindAll`, `bindKey`, `chain`, `chunk`, `commit`, | ||
* `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`, `curry`, | ||
* `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`, `curry`, | ||
* `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`, `difference`, | ||
* `differenceBy`, `differenceWith`, `drop`, `dropRight`, `dropRightWhile`, | ||
* `differenceBy`, `differenceWith`, `drop`, `dropRight`, `dropRightWhile`, | ||
* `dropWhile`, `fill`, `filter`, `flatten`, `flattenDeep`, `flip`, `flow`, | ||
* `flowRight`, `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`, | ||
* `forOwnRight`, `fromPairs`, `functions`, `functionsIn`, `groupBy`, `initial`, | ||
* `intersection`, `intersectionBy`, `intersectionWith`, invert`, `invokeMap`, | ||
* `flowRight`, `fromPairs`, `functions`, `functionsIn`, `groupBy`, `initial`, | ||
* `intersection`, `intersectionBy`, `intersectionWith`, `invert`, `invokeMap`, | ||
* `iteratee`, `keyBy`, `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, | ||
@@ -81,18 +80,19 @@ * `matches`, `matchesProperty`, `memoize`, `merge`, `mergeWith`, `method`, | ||
* `escape`, `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, | ||
* `findLast`, `findLastIndex`, `findLastKey`, `floor`, `get`, `gt`, `gte`, | ||
* `has`, `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, | ||
* `invoke`, `isArguments`, `isArray`, `isArrayLike`, `isArrayLikeObject`, | ||
* `isBoolean`, `isDate`, `isElement`, `isEmpty`, `isEqual`, `isEqualWith`, | ||
* `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`, `isMatch`, | ||
* `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`, `isNumber`, | ||
* `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`, `isSafeInteger`, | ||
* `isString`, `isUndefined`, `isTypedArray`, `join`, `kebabCase`, `last`, | ||
* `lastIndexOf`, `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, | ||
* `mean`, `min`, `minBy`, `noConflict`, `noop`, `now`, `pad`, `padEnd`, | ||
* `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`, `repeat`, | ||
* `result`, `round`, `runInContext`, `sample`, `shift`, `size`, `snakeCase`, | ||
* `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`, `sortedLastIndexBy`, | ||
* `startCase`, `startsWith`, `subtract`, `sum`, sumBy`, `template`, `times`, | ||
* `toLower`, `toInteger`, `toLength`, `toNumber`, `toSafeInteger`, toString`, | ||
* `toUpper`, `trim`, `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, | ||
* `findLast`, `findLastIndex`, `findLastKey`, `floor`, `forEach`, `forEachRight`, | ||
* `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`, | ||
* `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`, | ||
* `isArguments`, `isArray`, `isArrayLike`, `isArrayLikeObject`, `isBoolean`, | ||
* `isDate`, `isElement`, `isEmpty`, `isEqual`, `isEqualWith`, `isError`, | ||
* `isFinite`, `isFunction`, `isInteger`, `isLength`, `isMatch`, `isMatchWith`, | ||
* `isNaN`, `isNative`, `isNil`, `isNull`, `isNumber`, `isObject`, `isObjectLike`, | ||
* `isPlainObject`, `isRegExp`, `isSafeInteger`, `isString`, `isUndefined`, | ||
* `isTypedArray`, `join`, `kebabCase`, `last`, `lastIndexOf`, `lowerCase`, | ||
* `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `min`, `minBy`, | ||
* `noConflict`, `noop`, `now`, `pad`, `padEnd`, `padStart`, `parseInt`, | ||
* `pop`, `random`, `reduce`, `reduceRight`, `repeat`, `result`, `round`, | ||
* `runInContext`, `sample`, `shift`, `size`, `snakeCase`, `some`, `sortedIndex`, | ||
* `sortedIndexBy`, `sortedLastIndex`, `sortedLastIndexBy`, `startCase`, | ||
* `startsWith`, `subtract`, `sum`, `sumBy`, `template`, `times`, `toLower`, | ||
* `toInteger`, `toLength`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, | ||
* `trim`, `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, | ||
* `upperCase`, `upperFirst`, `value`, and `words` | ||
@@ -99,0 +99,0 @@ * |
@@ -8,3 +8,3 @@ var baseWrapperValue = require('./internal/baseWrapperValue'); | ||
* @memberOf _ | ||
* @alias run, toJSON, valueOf | ||
* @alias toJSON, valueOf | ||
* @category Seq | ||
@@ -11,0 +11,0 @@ * @returns {*} Returns the resolved unwrapped value. |
Sorry, the diff of this file is too big to display
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
1072261
522
32763
59
1