Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

lodash._createwrapper

Package Overview
Dependencies
Maintainers
3
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lodash._createwrapper - npm Package Compare versions

Comparing version 4.0.0 to 4.0.1

180

index.js
/**
* lodash 4.0.0 (Custom Build) <https://lodash.com/>
* lodash 4.0.1 (Custom Build) <https://lodash.com/>
* Build: `lodash modularize exports="npm" -o ./`

@@ -9,3 +9,2 @@ * Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/>

*/
var root = require('lodash._root');

@@ -54,6 +53,44 @@ /** Used to compose bitmasks for wrapper metadata. */

/** Used to determine if values are of the language type `Object`. */
var objectTypes = {
'function': true,
'object': true
};
/** Built-in method references without a dependency on `root`. */
var freeParseInt = parseInt;
/** Detect free variable `exports`. */
var freeExports = (objectTypes[typeof exports] && exports && !exports.nodeType)
? exports
: undefined;
/** Detect free variable `module`. */
var freeModule = (objectTypes[typeof module] && module && !module.nodeType)
? module
: undefined;
/** Detect free variable `global` from Node.js. */
var freeGlobal = checkGlobal(freeExports && freeModule && typeof global == 'object' && global);
/** Detect free variable `self`. */
var freeSelf = checkGlobal(objectTypes[typeof self] && self);
/** Detect free variable `window`. */
var freeWindow = checkGlobal(objectTypes[typeof window] && window);
/** Detect `this` as the global object. */
var thisGlobal = checkGlobal(objectTypes[typeof this] && this);
/**
* Used as a reference to the global object.
*
* The `this` value is used if it's the global object to avoid Greasemonkey's
* restricted `window` object, otherwise the `window` object is used.
*/
var root = freeGlobal ||
((freeWindow !== (thisGlobal && thisGlobal.window)) && freeWindow) ||
freeSelf || thisGlobal || Function('return this')();
/**
* A faster alternative to `Function#apply`, this function invokes `func`

@@ -80,2 +117,33 @@ * with the `this` binding of `thisArg` and the arguments of `args`.

/**
* Checks if `value` is a global object.
*
* @private
* @param {*} value The value to check.
* @returns {null|Object} Returns `value` if it's a global object, else `null`.
*/
function checkGlobal(value) {
return (value && value.Object === Object) ? value : null;
}
/**
* Gets the number of `placeholder` occurrences in `array`.
*
* @private
* @param {Array} array The array to inspect.
* @param {*} placeholder The placeholder to search for.
* @returns {number} Returns the placeholder count.
*/
function countHolders(array, placeholder) {
var length = array.length,
result = 0;
while (length--) {
if (array[length] === placeholder) {
result++;
}
}
return result;
}
/**
* Checks if `value` is a valid array-like index.

@@ -110,3 +178,4 @@ *

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

@@ -155,11 +224,14 @@ result[++resIndex] = index;

* @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;

@@ -170,5 +242,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++];

@@ -187,14 +261,17 @@ }

* @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];

@@ -207,3 +284,5 @@ }

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

@@ -300,6 +379,5 @@ return result;

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);

@@ -314,5 +392,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);
}

@@ -343,4 +425,3 @@ return wrapper;

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,

@@ -357,19 +438,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
);
}

@@ -379,8 +460,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;

@@ -438,3 +520,3 @@ }

* @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`.

@@ -451,3 +533,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,

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

var result = wrapFunc(func, bitmask, thisArg, newPartials, newsHolders, newPartialsRight, newHoldersRight, newArgPos, ary, arity);
var result = wrapFunc(func, bitmask, thisArg, newPartials, newHolders, newPartialsRight, newHoldersRight, newArgPos, ary, arity);
result.placeholder = placeholder;

@@ -546,2 +628,14 @@ return result;

/**
* Gets the argument placeholder value for `func`.
*
* @private
* @param {Function} func The function to inspect.
* @returns {*} Returns the placeholder value.
*/
function getPlaceholder(func) {
var object = func;
return object.placeholder;
}
/**
* Reorder `array` according to the specified indexes where the element at

@@ -548,0 +642,0 @@ * the first index is assigned as the first element, the element at

{
"name": "lodash._createwrapper",
"version": "4.0.0",
"version": "4.0.1",
"description": "The internal lodash function `createWrapper` exported as a module.",

@@ -15,6 +15,3 @@ "homepage": "https://lodash.com/",

"repository": "lodash/lodash",
"scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" },
"dependencies": {
"lodash._root": "^3.0.0"
}
"scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }
}

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

# lodash._createwrapper v4.0.0
# lodash._createwrapper v4.0.1

@@ -18,2 +18,2 @@ The internal [lodash](https://lodash.com/) function `createWrapper` exported as a [Node.js](https://nodejs.org/) module.

See the [package source](https://github.com/lodash/lodash/blob/4.0.0-npm-packages/lodash._createwrapper) for more details.
See the [package source](https://github.com/lodash/lodash/blob/4.0.1-npm-packages/lodash._createwrapper) for more details.
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