Socket
Socket
Sign inDemoInstall

lodash

Package Overview
Dependencies
Maintainers
4
Versions
114
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lodash - npm Package Compare versions

Comparing version 4.5.0 to 4.5.1

_countHolders.js

3

_assignValue.js

@@ -21,4 +21,3 @@ var eq = require('./eq');

var objValue = object[key];
if ((!eq(objValue, value) ||
(eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) ||
if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
(value === undefined && !(key in object))) {

@@ -25,0 +24,0 @@ object[key] = value;

@@ -12,11 +12,14 @@ /* Built-in method references for those with the same name as other `lodash` methods. */

* @param {Array} holders The `partials` placeholder indexes.
* @params {boolean} [isCurried] Specify composing for a curried function.
* @returns {Array} Returns the new array of composed arguments.
*/
function composeArgs(args, partials, holders) {
var holdersLength = holders.length,
argsIndex = -1,
argsLength = nativeMax(args.length - holdersLength, 0),
function composeArgs(args, partials, holders, isCurried) {
var argsIndex = -1,
argsLength = args.length,
holdersLength = holders.length,
leftIndex = -1,
leftLength = partials.length,
result = Array(leftLength + argsLength);
rangeLength = nativeMax(argsLength - holdersLength, 0),
result = Array(leftLength + rangeLength),
isUncurried = !isCurried;

@@ -27,5 +30,7 @@ while (++leftIndex < leftLength) {

while (++argsIndex < holdersLength) {
result[holders[argsIndex]] = args[argsIndex];
if (isUncurried || argsIndex < argsLength) {
result[holders[argsIndex]] = args[argsIndex];
}
}
while (argsLength--) {
while (rangeLength--) {
result[leftIndex++] = args[argsIndex++];

@@ -32,0 +37,0 @@ }

@@ -12,14 +12,17 @@ /* Built-in method references for those with the same name as other `lodash` methods. */

* @param {Array} holders The `partials` placeholder indexes.
* @params {boolean} [isCurried] Specify composing for a curried function.
* @returns {Array} Returns the new array of composed arguments.
*/
function composeArgsRight(args, partials, holders) {
var holdersIndex = -1,
function composeArgsRight(args, partials, holders, isCurried) {
var argsIndex = -1,
argsLength = args.length,
holdersIndex = -1,
holdersLength = holders.length,
argsIndex = -1,
argsLength = nativeMax(args.length - holdersLength, 0),
rightIndex = -1,
rightLength = partials.length,
result = Array(argsLength + rightLength);
rangeLength = nativeMax(argsLength - holdersLength, 0),
result = Array(rangeLength + rightLength),
isUncurried = !isCurried;
while (++argsIndex < argsLength) {
while (++argsIndex < rangeLength) {
result[argsIndex] = args[argsIndex];

@@ -32,3 +35,5 @@ }

while (++holdersIndex < holdersLength) {
result[offset + holders[holdersIndex]] = args[argsIndex++];
if (isUncurried || argsIndex < argsLength) {
result[offset + holders[holdersIndex]] = args[argsIndex++];
}
}

@@ -35,0 +40,0 @@ return result;

@@ -5,2 +5,3 @@ var apply = require('./_apply'),

createRecurryWrapper = require('./_createRecurryWrapper'),
getPlaceholder = require('./_getPlaceholder'),
replaceHolders = require('./_replaceHolders'),

@@ -23,6 +24,5 @@ root = require('./_root');

var length = arguments.length,
args = Array(length),
index = length,
args = Array(length),
fn = (this && this !== root && this instanceof wrapper) ? Ctor : func,
placeholder = wrapper.placeholder;
placeholder = getPlaceholder(wrapper);

@@ -37,5 +37,9 @@ while (index--) {

length -= holders.length;
return length < arity
? createRecurryWrapper(func, bitmask, createHybridWrapper, placeholder, undefined, args, holders, undefined, undefined, arity - length)
: apply(fn, this, args);
if (length < arity) {
return createRecurryWrapper(
func, bitmask, createHybridWrapper, wrapper.placeholder, undefined,
args, holders, undefined, undefined, arity - length);
}
var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
return apply(fn, this, args);
}

@@ -42,0 +46,0 @@ return wrapper;

var composeArgs = require('./_composeArgs'),
composeArgsRight = require('./_composeArgsRight'),
countHolders = require('./_countHolders'),
createCtorWrapper = require('./_createCtorWrapper'),
createRecurryWrapper = require('./_createRecurryWrapper'),
getPlaceholder = require('./_getPlaceholder'),
reorder = require('./_reorder'),

@@ -38,4 +40,3 @@ replaceHolders = require('./_replaceHolders'),

isBindKey = bitmask & BIND_KEY_FLAG,
isCurry = bitmask & CURRY_FLAG,
isCurryRight = bitmask & CURRY_RIGHT_FLAG,
isCurried = bitmask & (CURRY_FLAG | CURRY_RIGHT_FLAG),
isFlip = bitmask & FLIP_FLAG,

@@ -52,19 +53,19 @@ Ctor = isBindKey ? undefined : createCtorWrapper(func);

}
if (isCurried) {
var placeholder = getPlaceholder(wrapper),
holdersCount = countHolders(args, placeholder);
}
if (partials) {
args = composeArgs(args, partials, holders);
args = composeArgs(args, partials, holders, isCurried);
}
if (partialsRight) {
args = composeArgsRight(args, partialsRight, holdersRight);
args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
}
if (isCurry || isCurryRight) {
var placeholder = wrapper.placeholder,
argsHolders = replaceHolders(args, placeholder);
length -= argsHolders.length;
if (length < arity) {
return createRecurryWrapper(
func, bitmask, createHybridWrapper, placeholder, thisArg, args,
argsHolders, argPos, ary, arity - length
);
}
length -= holdersCount;
if (isCurried && length < arity) {
var newHolders = replaceHolders(args, placeholder);
return createRecurryWrapper(
func, bitmask, createHybridWrapper, wrapper.placeholder, thisArg,
args, newHolders, argPos, ary, arity - length
);
}

@@ -74,8 +75,9 @@ var thisBinding = isBind ? thisArg : this,

length = args.length;
if (argPos) {
args = reorder(args, argPos);
} else if (isFlip && args.length > 1) {
} else if (isFlip && length > 1) {
args.reverse();
}
if (isAry && ary < args.length) {
if (isAry && ary < length) {
args.length = ary;

@@ -82,0 +84,0 @@ }

@@ -20,3 +20,3 @@ var copyArray = require('./_copyArray'),

* @param {Function} wrapFunc The function to create the `func` wrapper.
* @param {*} placeholder The placeholder to replace.
* @param {*} placeholder The placeholder value.
* @param {*} [thisArg] The `this` binding of `func`.

@@ -33,3 +33,3 @@ * @param {Array} [partials] The arguments to prepend to those provided to the new function.

newArgPos = argPos ? copyArray(argPos) : undefined,
newsHolders = isCurry ? holders : undefined,
newHolders = isCurry ? holders : undefined,
newHoldersRight = isCurry ? undefined : holders,

@@ -46,3 +46,3 @@ newPartials = isCurry ? partials : undefined,

var newData = [
func, bitmask, thisArg, newPartials, newsHolders, newPartialsRight,
func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
newHoldersRight, newArgPos, ary, arity

@@ -49,0 +49,0 @@ ];

@@ -5,2 +5,5 @@ var baseCreate = require('./_baseCreate'),

/** Built-in value references. */
var getPrototypeOf = Object.getPrototypeOf;
/**

@@ -14,9 +17,7 @@ * Initializes an object clone.

function initCloneObject(object) {
if (isPrototype(object)) {
return {};
}
var Ctor = object.constructor;
return baseCreate(isFunction(Ctor) ? Ctor.prototype : undefined);
return (isFunction(object.constructor) && !isPrototype(object))
? baseCreate(getPrototypeOf(object))
: {};
}
module.exports = initCloneObject;

@@ -0,1 +1,3 @@

var isFunction = require('./isFunction');
/** Used for built-in method references. */

@@ -13,3 +15,3 @@ var objectProto = Object.prototype;

var Ctor = value && value.constructor,
proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
proto = (isFunction(Ctor) && Ctor.prototype) || objectProto;

@@ -16,0 +18,0 @@ return value === proto;

@@ -42,5 +42,5 @@ var composeArgs = require('./_composeArgs'),

var isCombo =
(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));
((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));

@@ -55,3 +55,3 @@ // Exit early if metadata can't be merged.

// Set when currying a bound function.
newBitmask |= (bitmask & BIND_FLAG) ? 0 : CURRY_BOUND_FLAG;
newBitmask |= bitmask & BIND_FLAG ? 0 : CURRY_BOUND_FLAG;
}

@@ -58,0 +58,0 @@ // Compose partial arguments.

@@ -20,3 +20,4 @@ /** Used as the internal argument placeholder. */

while (++index < length) {
if (array[index] === placeholder) {
var value = array[index];
if (value === placeholder || value === PLACEHOLDER) {
array[index] = PLACEHOLDER;

@@ -23,0 +24,0 @@ result[++resIndex] = index;

var createWrapper = require('./_createWrapper'),
getPlaceholder = require('./_getPlaceholder'),
replaceHolders = require('./_replaceHolders'),

@@ -47,5 +48,3 @@ rest = require('./rest');

if (partials.length) {
var placeholder = bind.placeholder,
holders = replaceHolders(partials, placeholder);
var holders = replaceHolders(partials, getPlaceholder(bind));
bitmask |= PARTIAL_FLAG;

@@ -52,0 +51,0 @@ }

var createWrapper = require('./_createWrapper'),
getPlaceholder = require('./_getPlaceholder'),
replaceHolders = require('./_replaceHolders'),

@@ -57,5 +58,3 @@ rest = require('./rest');

if (partials.length) {
var placeholder = bindKey.placeholder,
holders = replaceHolders(partials, placeholder);
var holders = replaceHolders(partials, getPlaceholder(bindKey));
bitmask |= PARTIAL_FLAG;

@@ -62,0 +61,0 @@ }

@@ -1,2 +0,2 @@

var _ = require('./lodash').runInContext();
module.exports = require('./fp/convert')(_);
var _ = require('./lodash.min').runInContext();
module.exports = require('./fp/_baseConvert')(_, _);

@@ -47,3 +47,3 @@ var mapping = require('./_mapping'),

'ary': util.ary,
'cloneDeep': util.cloneDeep,
'clone': util.clone,
'curry': util.curry,

@@ -56,7 +56,8 @@ 'forEach': util.forEach,

'rearg': util.rearg,
'spread': util.spread
'spread': util.spread,
'toPath': util.toPath
};
var ary = helpers.ary,
cloneDeep = helpers.cloneDeep,
clone = helpers.clone,
curry = helpers.curry,

@@ -68,6 +69,13 @@ each = helpers.forEach,

rearg = helpers.rearg,
spread = helpers.spread;
spread = helpers.spread,
toPath = helpers.toPath;
var aryMethodKeys = keys(mapping.aryMethod);
var baseArity = function(func, n) {
return n == 2
? function(a, b) { return func.apply(undefined, arguments); }
: function(a) { return func.apply(undefined, arguments); };
};
var baseAry = function(func, n) {

@@ -89,2 +97,22 @@ return n == 2

var cloneByPath = function(object, path) {
path = toPath(path);
var index = -1,
length = path.length,
result = clone(Object(object)),
nested = result;
while (nested != null && ++index < length) {
var key = path[index],
value = nested[key];
if (value != null) {
nested[key] = clone(Object(value));
}
nested = nested[key];
}
return result;
};
var createCloner = function(func) {

@@ -106,3 +134,3 @@ return function(object) {

}
var result = args[0] = cloner(args[0]);
var result = args[0] = cloner.apply(undefined, args);
func.apply(undefined, args);

@@ -115,8 +143,13 @@ return result;

return overArg(func, function(func) {
return typeof func == 'function'
? baseAry(func, n)
: func;
return typeof func == 'function' ? baseAry(func, n) : func;
});
};
var iterateeRearg = function(func, indexes) {
return overArg(func, function(func) {
var n = indexes.length;
return baseArity(rearg(baseAry(func, n), indexes), n);
});
};
var overArg = function(func, iteratee, retArg) {

@@ -150,11 +183,11 @@ return function() {

var func = arguments[0],
arity = arguments[1];
arity = arguments[1],
result = iteratee(func, arity),
length = result.length;
if (!config.cap) {
return iteratee(func, arity);
if (config.cap && typeof arity == 'number') {
arity = arity > 2 ? (arity - 2) : 1;
return (length && length <= arity) ? result : baseAry(result, arity);
}
arity = arity > 2 ? (arity - 2) : 1;
func = iteratee(func);
var length = func.length;
return (length && length <= arity) ? func : baseAry(func, arity);
return result;
};

@@ -214,3 +247,3 @@ },

else if (mutateMap.set[name]) {
wrapped = immutWrap(func, cloneDeep);
wrapped = immutWrap(func, cloneByPath);
}

@@ -223,2 +256,3 @@ }

var aryN = !isLib && mapping.iterateeAry[name],
reargIndexes = mapping.iterateeRearg[name],
spreadStart = mapping.methodSpread[name];

@@ -235,4 +269,8 @@

}
if (config.cap && aryN) {
result = iterateeAry(result, aryN);
if (config.cap) {
if (reargIndexes) {
result = iterateeRearg(result, reargIndexes);
} else if (aryN) {
result = iterateeAry(result, aryN);
}
}

@@ -239,0 +277,0 @@ if (config.curry && aryKey > 1) {

@@ -58,3 +58,3 @@ /** Used to map aliases to their real names. */

'mapKeys', 'mapValues', 'matchesProperty', 'maxBy', 'merge', 'minBy', 'omit',
'omitBy', 'orderBy', 'overArgs', 'pad', 'padEnd', 'padStart', 'parseInt',
'omitBy', 'overArgs', 'pad', 'padEnd', 'padStart', 'parseInt',
'partial', 'partialRight', 'partition', 'pick', 'pickBy', 'pull', 'pullAll',

@@ -72,5 +72,5 @@ 'pullAt', 'random', 'range', 'rangeRight', 'rearg', 'reject', 'remove',

'getOr', 'inRange', 'intersectionBy', 'intersectionWith', 'isEqualWith',
'isMatchWith', 'mergeWith', 'pullAllBy', 'reduce', 'reduceRight', 'replace',
'set', 'slice', 'sortedIndexBy', 'sortedLastIndexBy', 'transform', 'unionBy',
'unionWith', 'xorBy', 'xorWith', 'zipWith'
'isMatchWith', 'mergeWith', 'orderBy', 'pullAllBy', 'reduce', 'reduceRight',
'replace', 'set', 'slice', 'sortedIndexBy', 'sortedLastIndexBy', 'transform',
'unionBy', 'unionWith', 'xorBy', 'xorWith', 'zipWith'
],

@@ -129,2 +129,7 @@ '4': [

/** Used to map method names to iteratee rearg configs. */
exports.iterateeRearg = {
'mapKeys': [1]
};
/** Used to map method names to rearg configs. */

@@ -131,0 +136,0 @@ exports.methodRearg = {

module.exports = {
'ary': require('../ary'),
'cloneDeep': require('../cloneDeep'),
'clone': require('../clone'),
'curry': require('../curry'),

@@ -11,3 +11,4 @@ 'forEach': require('../_arrayEach'),

'rearg': require('../rearg'),
'spread': require('../spread')
'spread': require('../spread'),
'toPath': require('../toPath')
};

@@ -36,7 +36,6 @@ var isObjectLike = require('./isObjectLike');

}
var Ctor = value.constructor;
return (objectToString.call(value) == errorTag) ||
(typeof Ctor == 'function' && objectToString.call(Ctor.prototype) == errorTag);
(typeof value.message == 'string' && typeof value.name == 'string');
}
module.exports = isError;

@@ -57,6 +57,3 @@ var isHostObject = require('./_isHostObject'),

}
var proto = objectProto;
if (typeof value.constructor == 'function') {
proto = getPrototypeOf(value);
}
var proto = getPrototypeOf(value);
if (proto === null) {

@@ -63,0 +60,0 @@ return true;

@@ -7,3 +7,4 @@ var baseForOwn = require('./_baseForOwn'),

* same values as `object` and keys generated by running each own enumerable
* property of `object` through `iteratee`.
* property of `object` through `iteratee`. The iteratee is invoked with
* three arguments: (value, key, object).
*

@@ -10,0 +11,0 @@ * @static

@@ -7,3 +7,3 @@ var baseForOwn = require('./_baseForOwn'),

* running each own enumerable property of `object` through `iteratee`. The
* iteratee function is invoked with three arguments: (value, key, object).
* iteratee is invoked with three arguments: (value, key, object).
*

@@ -10,0 +10,0 @@ * @static

@@ -5,5 +5,6 @@ var baseIteratee = require('./_baseIteratee'),

/**
* The opposite of `_.pickBy`; this method creates an object composed of the
* own and inherited enumerable properties of `object` that `predicate`
* doesn't return truthy for.
* The opposite of `_.pickBy`; this method creates an object composed of
* the own and inherited enumerable properties of `object` that `predicate`
* doesn't return truthy for. The predicate is invoked with two arguments:
* (value, key).
*

@@ -24,3 +25,3 @@ * @static

function omitBy(object, predicate) {
predicate = baseIteratee(predicate, 2);
predicate = baseIteratee(predicate);
return basePickBy(object, function(value, key) {

@@ -27,0 +28,0 @@ return !predicate(value, key);

{
"name": "lodash",
"version": "4.5.0",
"version": "4.5.1",
"description": "Lodash modular utilities.",

@@ -5,0 +5,0 @@ "homepage": "https://lodash.com/",

var createWrapper = require('./_createWrapper'),
getPlaceholder = require('./_getPlaceholder'),
replaceHolders = require('./_replaceHolders'),

@@ -41,5 +42,3 @@ rest = require('./rest');

var partial = rest(function(func, partials) {
var placeholder = partial.placeholder,
holders = replaceHolders(partials, placeholder);
var holders = replaceHolders(partials, getPlaceholder(partial));
return createWrapper(func, PARTIAL_FLAG, undefined, partials, holders);

@@ -46,0 +45,0 @@ });

var createWrapper = require('./_createWrapper'),
getPlaceholder = require('./_getPlaceholder'),
replaceHolders = require('./_replaceHolders'),

@@ -40,5 +41,3 @@ rest = require('./rest');

var partialRight = rest(function(func, partials) {
var placeholder = partialRight.placeholder,
holders = replaceHolders(partials, placeholder);
var holders = replaceHolders(partials, getPlaceholder(partialRight));
return createWrapper(func, PARTIAL_RIGHT_FLAG, undefined, partials, holders);

@@ -45,0 +44,0 @@ });

@@ -22,5 +22,5 @@ var baseIteratee = require('./_baseIteratee'),

function pickBy(object, predicate) {
return object == null ? {} : basePickBy(object, baseIteratee(predicate, 2));
return object == null ? {} : basePickBy(object, baseIteratee(predicate));
}
module.exports = pickBy;

@@ -9,3 +9,4 @@ var pullAll = require('./pullAll'),

*
* **Note:** Unlike `_.without`, this method mutates `array`.
* **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
* to remove elements from an array by predicate.
*

@@ -12,0 +13,0 @@ * @static

@@ -1,2 +0,2 @@

# lodash v4.5.0
# lodash v4.5.1

@@ -31,3 +31,3 @@ The [lodash](https://lodash.com/) library exported as [Node.js](https://nodejs.org/) modules.

See the [package source](https://github.com/lodash/lodash/tree/4.5.0-npm) for more details.
See the [package source](https://github.com/lodash/lodash/tree/4.5.1-npm) for more details.

@@ -34,0 +34,0 @@ **Note:**<br>

@@ -6,6 +6,7 @@ var baseIteratee = require('./_baseIteratee'),

* Removes all elements from `array` that `predicate` returns truthy for
* and returns an array of the removed elements. The predicate is invoked with
* three arguments: (value, index, array).
* and returns an array of the removed elements. The predicate is invoked
* with three arguments: (value, index, array).
*
* **Note:** Unlike `_.filter`, this method mutates `array`.
* **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
* to pull elements from an array by value.
*

@@ -12,0 +13,0 @@ * @static

@@ -15,4 +15,4 @@ var baseCastFunction = require('./_baseCastFunction'),

/**
* Invokes the iteratee function `n` times, returning an array of the results
* of each invocation. The iteratee is invoked with one argument; (index).
* Invokes the iteratee `n` times, returning an array of the results of
* each invocation. The iteratee is invoked with one argument; (index).
*

@@ -19,0 +19,0 @@ * @static

@@ -10,2 +10,5 @@ var arrayEach = require('./_arrayEach'),

/** Built-in value references. */
var getPrototypeOf = Object.getPrototypeOf;
/**

@@ -49,3 +52,3 @@ * An alternative to `_.reduce`; this method transforms `object` to a new

} else {
accumulator = baseCreate(isFunction(Ctor) ? Ctor.prototype : undefined);
accumulator = isFunction(Ctor) ? baseCreate(getPrototypeOf(object)) : {};
}

@@ -52,0 +55,0 @@ } else {

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc