lodash.partialright
Advanced tools
Comparing version 3.1.1 to 4.0.0
48
index.js
/** | ||
* lodash 3.1.1 (Custom Build) <https://lodash.com/> | ||
* Build: `lodash modern modularize exports="npm" -o ./` | ||
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/> | ||
* lodash 4.0.0 (Custom Build) <https://lodash.com/> | ||
* Build: `lodash modularize exports="npm" -o ./` | ||
* Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/> | ||
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> | ||
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors | ||
* Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors | ||
* Available under MIT license <https://lodash.com/license> | ||
*/ | ||
var createWrapper = require('lodash._createwrapper'), | ||
replaceHolders = require('lodash._replaceholders'), | ||
restParam = require('lodash.restparam'); | ||
rest = require('lodash.rest'); | ||
@@ -16,15 +15,27 @@ /** Used to compose bitmasks for wrapper metadata. */ | ||
/** Used as the internal argument placeholder. */ | ||
var PLACEHOLDER = '__lodash_placeholder__'; | ||
/** | ||
* Creates a `_.partial` or `_.partialRight` function. | ||
* Replaces all `placeholder` elements in `array` with an internal placeholder | ||
* and returns an array of their indexes. | ||
* | ||
* @private | ||
* @param {boolean} flag The partial bit flag. | ||
* @returns {Function} Returns the new partial function. | ||
* @param {Array} array The array to modify. | ||
* @param {*} placeholder The placeholder to replace. | ||
* @returns {Array} Returns the new array of placeholder indexes. | ||
*/ | ||
function createPartial(flag) { | ||
var partialFunc = restParam(function(func, partials) { | ||
var holders = replaceHolders(partials, partialFunc.placeholder); | ||
return createWrapper(func, flag, undefined, partials, holders); | ||
}); | ||
return partialFunc; | ||
function replaceHolders(array, placeholder) { | ||
var index = -1, | ||
length = array.length, | ||
resIndex = -1, | ||
result = []; | ||
while (++index < length) { | ||
if (array[index] === placeholder) { | ||
array[index] = PLACEHOLDER; | ||
result[++resIndex] = index; | ||
} | ||
} | ||
return result; | ||
} | ||
@@ -39,3 +50,3 @@ | ||
* | ||
* **Note:** This method does not set the "length" property of partially | ||
* **Note:** This method doesn't set the "length" property of partially | ||
* applied functions. | ||
@@ -64,3 +75,6 @@ * | ||
*/ | ||
var partialRight = createPartial(PARTIAL_RIGHT_FLAG); | ||
var partialRight = rest(function(func, partials) { | ||
var holders = replaceHolders(partials, partialRight.placeholder); | ||
return createWrapper(func, PARTIAL_RIGHT_FLAG, undefined, partials, holders); | ||
}); | ||
@@ -67,0 +81,0 @@ // Assign default placeholders. |
{ | ||
"name": "lodash.partialright", | ||
"version": "3.1.1", | ||
"description": "The modern build of lodash’s `_.partialRight` as a module.", | ||
"version": "4.0.0", | ||
"description": "The lodash method `_.partialRight` exported as a module.", | ||
"homepage": "https://lodash.com/", | ||
"icon": "https://lodash.com/icon.svg", | ||
"license": "MIT", | ||
"keywords": "lodash, lodash-modularized, stdlib, util", | ||
"keywords": "lodash, lodash-modularized, stdlib, util, partialright", | ||
"author": "John-David Dalton <john.david.dalton@gmail.com> (http://allyoucanleet.com/)", | ||
"contributors": [ | ||
"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@iceddev.com> (https://github.com/phated)", | ||
"Mathias Bynens <mathias@qiwi.be> (https://mathiasbynens.be/)" | ||
@@ -21,5 +19,4 @@ ], | ||
"lodash._createwrapper": "^3.0.0", | ||
"lodash._replaceholders": "^3.0.0", | ||
"lodash.restparam": "^3.0.0" | ||
"lodash.rest": "^4.0.0" | ||
} | ||
} |
@@ -1,4 +0,4 @@ | ||
# lodash.partialright v3.1.1 | ||
# lodash.partialright v4.0.0 | ||
The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) `_.partialRight` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module. | ||
The [lodash](https://lodash.com/) method `_.partialRight` exported as a [Node.js](https://nodejs.org/) module. | ||
@@ -8,3 +8,2 @@ ## Installation | ||
Using npm: | ||
```bash | ||
@@ -15,4 +14,3 @@ $ {sudo -H} npm i -g npm | ||
In Node.js/io.js: | ||
In Node.js: | ||
```js | ||
@@ -22,2 +20,2 @@ var partialRight = require('lodash.partialright'); | ||
See the [documentation](https://lodash.com/docs#partialRight) or [package source](https://github.com/lodash/lodash/blob/3.1.1-npm-packages/lodash.partialright) for more details. | ||
See the [documentation](https://lodash.com/docs#partialRight) or [package source](https://github.com/lodash/lodash/blob/4.0.0-npm-packages/lodash.partialright) for more details. |
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
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
5141
2
105112
74
19
+ Addedlodash.rest@^4.0.0
+ Addedlodash.rest@4.0.5(transitive)
- Removedlodash._replaceholders@^3.0.0
- Removedlodash.restparam@^3.0.0
- Removedlodash._replaceholders@3.0.0(transitive)
- Removedlodash.restparam@3.6.1(transitive)