mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-09 02:17:50 +00:00
Bump to v4.0.0.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
|
||||
Based on Underscore.js, copyright 2009-2015 Jeremy Ashkenas,
|
||||
Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/>
|
||||
Based on Underscore.js, copyright 2009-2016 Jeremy Ashkenas,
|
||||
DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
|
||||
@@ -1,20 +1,18 @@
|
||||
# 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.
|
||||
|
||||
## Installation
|
||||
|
||||
Using npm:
|
||||
|
||||
```bash
|
||||
$ {sudo -H} npm i -g npm
|
||||
$ npm i --save lodash.partialright
|
||||
```
|
||||
|
||||
In Node.js/io.js:
|
||||
|
||||
In Node.js:
|
||||
```js
|
||||
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.
|
||||
|
||||
@@ -1,31 +1,42 @@
|
||||
/**
|
||||
* 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');
|
||||
|
||||
/** Used to compose bitmasks for wrapper metadata. */
|
||||
var PARTIAL_RIGHT_FLAG = 64;
|
||||
|
||||
/** 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;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -35,7 +46,7 @@ function createPartial(flag) {
|
||||
* The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
|
||||
* builds, may be used as a placeholder for partially applied arguments.
|
||||
*
|
||||
* **Note:** This method does not set the "length" property of partially
|
||||
* **Note:** This method doesn't set the "length" property of partially
|
||||
* applied functions.
|
||||
*
|
||||
* @static
|
||||
@@ -54,12 +65,15 @@ function createPartial(flag) {
|
||||
* greetFred('hi');
|
||||
* // => 'hi fred'
|
||||
*
|
||||
* // using placeholders
|
||||
* // Partially applied with placeholders.
|
||||
* var sayHelloTo = _.partialRight(greet, 'hello', _);
|
||||
* sayHelloTo('fred');
|
||||
* // => 'hello fred'
|
||||
*/
|
||||
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);
|
||||
});
|
||||
|
||||
// Assign default placeholders.
|
||||
partialRight.placeholder = {};
|
||||
|
||||
@@ -1,24 +1,21 @@
|
||||
{
|
||||
"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/)"
|
||||
],
|
||||
"repository": "lodash/lodash",
|
||||
"scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" },
|
||||
"dependencies": {
|
||||
"lodash._createwrapper": "^3.0.0",
|
||||
"lodash._replaceholders": "^3.0.0",
|
||||
"lodash.restparam": "^3.0.0"
|
||||
"lodash.rest": "^4.0.0"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user