mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-05 17:37:50 +00:00
Bump to v4.0.2.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# lodash.partition v4.0.1
|
||||
# lodash.partition v4.0.2
|
||||
|
||||
The [lodash](https://lodash.com/) method `_.partition` exported as a [Node.js](https://nodejs.org/) module.
|
||||
|
||||
@@ -15,4 +15,4 @@ In Node.js:
|
||||
var partition = require('lodash.partition');
|
||||
```
|
||||
|
||||
See the [documentation](https://lodash.com/docs#partition) or [package source](https://github.com/lodash/lodash/blob/4.0.1-npm-packages/lodash.partition) for more details.
|
||||
See the [documentation](https://lodash.com/docs#partition) or [package source](https://github.com/lodash/lodash/blob/4.0.2-npm-packages/lodash.partition) for more details.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* lodash 4.0.1 (Custom Build) <https://lodash.com/>
|
||||
* lodash 4.0.2 (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>
|
||||
@@ -31,6 +31,27 @@ var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
|
||||
/** Used to match backslashes in property paths. */
|
||||
var reEscapeChar = /\\(\\)?/g;
|
||||
|
||||
/**
|
||||
* A specialized version of `baseAggregator` for arrays.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} array The array to iterate over.
|
||||
* @param {Function} setter The function to set `accumulator` values.
|
||||
* @param {Function} iteratee The iteratee to transform keys.
|
||||
* @param {Object} accumulator The initial aggregated object.
|
||||
* @returns {Function} Returns `accumulator`.
|
||||
*/
|
||||
function arrayAggregator(array, setter, iteratee, accumulator) {
|
||||
var index = -1,
|
||||
length = array.length;
|
||||
|
||||
while (++index < length) {
|
||||
var value = array[index];
|
||||
setter(accumulator, value, iteratee(value), array);
|
||||
}
|
||||
return accumulator;
|
||||
}
|
||||
|
||||
/** Used for built-in method references. */
|
||||
var objectProto = global.Object.prototype;
|
||||
|
||||
@@ -47,6 +68,24 @@ var Symbol = global.Symbol;
|
||||
var symbolProto = Symbol ? Symbol.prototype : undefined,
|
||||
symbolToString = Symbol ? symbolProto.toString : undefined;
|
||||
|
||||
/**
|
||||
* Aggregates elements of `collection` on `accumulator` with keys transformed
|
||||
* by `iteratee` and values set by `setter`.
|
||||
*
|
||||
* @private
|
||||
* @param {Array|Object} collection The collection to iterate over.
|
||||
* @param {Function} setter The function to set `accumulator` values.
|
||||
* @param {Function} iteratee The iteratee to transform keys.
|
||||
* @param {Object} accumulator The initial aggregated object.
|
||||
* @returns {Function} Returns `accumulator`.
|
||||
*/
|
||||
function baseAggregator(collection, setter, iteratee, accumulator) {
|
||||
baseEach(collection, function(value, key, collection) {
|
||||
setter(accumulator, value, iteratee(value), collection);
|
||||
});
|
||||
return accumulator;
|
||||
}
|
||||
|
||||
/**
|
||||
* The base implementation of `_.get` without support for default values.
|
||||
*
|
||||
@@ -175,29 +214,16 @@ function baseToPath(value) {
|
||||
* Creates a function like `_.groupBy`.
|
||||
*
|
||||
* @private
|
||||
* @param {Function} setter The function to set keys and values of the accumulator object.
|
||||
* @param {Function} [initializer] The function to initialize the accumulator object.
|
||||
* @param {Function} setter The function to set accumulator values.
|
||||
* @param {Function} [initializer] The accumulator object initializer.
|
||||
* @returns {Function} Returns the new aggregator function.
|
||||
*/
|
||||
function createAggregator(setter, initializer) {
|
||||
return function(collection, iteratee) {
|
||||
var result = initializer ? initializer() : {};
|
||||
iteratee = baseIteratee(iteratee);
|
||||
var func = isArray(collection) ? arrayAggregator : baseAggregator,
|
||||
accumulator = initializer ? initializer() : {};
|
||||
|
||||
if (isArray(collection)) {
|
||||
var index = -1,
|
||||
length = collection.length;
|
||||
|
||||
while (++index < length) {
|
||||
var value = collection[index];
|
||||
setter(result, value, iteratee(value), collection);
|
||||
}
|
||||
} else {
|
||||
baseEach(collection, function(value, key, collection) {
|
||||
setter(result, value, iteratee(value), collection);
|
||||
});
|
||||
}
|
||||
return result;
|
||||
return func(collection, setter, baseIteratee(iteratee), accumulator);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -350,8 +376,6 @@ var isArray = Array.isArray;
|
||||
* // => false
|
||||
*/
|
||||
function isObject(value) {
|
||||
// Avoid a V8 JIT bug in Chrome 19-20.
|
||||
// See https://code.google.com/p/v8/issues/detail?id=2291 for more details.
|
||||
var type = typeof value;
|
||||
return !!value && (type == 'object' || type == 'function');
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"name": "lodash.partition",
|
||||
"version": "4.0.1",
|
||||
"version": "4.0.2",
|
||||
"description": "The lodash method `_.partition` exported as a module.",
|
||||
"homepage": "https://lodash.com/",
|
||||
"icon": "https://lodash.com/icon.svg",
|
||||
"license": "MIT",
|
||||
"keywords": "lodash, lodash-modularized, stdlib, util, partition",
|
||||
"keywords": "lodash-modularized, partition",
|
||||
"author": "John-David Dalton <john.david.dalton@gmail.com> (http://allyoucanleet.com/)",
|
||||
"contributors": [
|
||||
"John-David Dalton <john.david.dalton@gmail.com> (http://allyoucanleet.com/)",
|
||||
|
||||
Reference in New Issue
Block a user