mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-08 02:17:48 +00:00
Bump to v3.6.2.
This commit is contained in:
committed by
John-David Dalton
parent
4ed2b24773
commit
bbc20f983e
@@ -1,4 +1,4 @@
|
||||
# lodash.sum v3.6.1
|
||||
# lodash.sum v3.6.2
|
||||
|
||||
The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash’s](https://lodash.com/) `_.sum` exported as a [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) module.
|
||||
|
||||
@@ -17,4 +17,4 @@ In Node.js/io.js:
|
||||
var sum = require('lodash.sum');
|
||||
```
|
||||
|
||||
See the [documentation](https://lodash.com/docs#sum) or [package source](https://github.com/lodash/lodash/blob/3.6.1-npm-packages/lodash.sum) for more details.
|
||||
See the [documentation](https://lodash.com/docs#sum) or [package source](https://github.com/lodash/lodash/blob/3.6.2-npm-packages/lodash.sum) for more details.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* lodash 3.6.1 (Custom Build) <https://lodash.com/>
|
||||
* lodash 3.6.2 (Custom Build) <https://lodash.com/>
|
||||
* Build: `lodash modern modularize exports="npm" -o ./`
|
||||
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
|
||||
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
||||
@@ -13,18 +13,20 @@ var baseCallback = require('lodash._basecallback'),
|
||||
isArray = require('lodash.isarray');
|
||||
|
||||
/**
|
||||
* A specialized version of `_.sum` for arrays without support for iteratees.
|
||||
* A specialized version of `_.sum` for arrays without support for callback
|
||||
* shorthands and `this` binding..
|
||||
*
|
||||
* @private
|
||||
* @param {Array} array The array to iterate over.
|
||||
* @param {Function} iteratee The function invoked per iteration.
|
||||
* @returns {number} Returns the sum.
|
||||
*/
|
||||
function arraySum(array) {
|
||||
function arraySum(array, iteratee) {
|
||||
var length = array.length,
|
||||
result = 0;
|
||||
|
||||
while (length--) {
|
||||
result += +array[length] || 0;
|
||||
result += +iteratee(array[length]) || 0;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -80,13 +82,11 @@ function baseSum(collection, iteratee) {
|
||||
*/
|
||||
function sum(collection, iteratee, thisArg) {
|
||||
if (thisArg && isIterateeCall(collection, iteratee, thisArg)) {
|
||||
iteratee = null;
|
||||
iteratee = undefined;
|
||||
}
|
||||
var noIteratee = iteratee == null;
|
||||
|
||||
iteratee = noIteratee ? iteratee : baseCallback(iteratee, thisArg, 3);
|
||||
return noIteratee
|
||||
? arraySum(isArray(collection) ? collection : toIterable(collection))
|
||||
iteratee = baseCallback(iteratee, thisArg, 3);
|
||||
return iteratee.length == 1
|
||||
? arraySum(isArray(collection) ? collection : toIterable(collection), iteratee)
|
||||
: baseSum(collection, iteratee);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "lodash.sum",
|
||||
"version": "3.6.1",
|
||||
"version": "3.6.2",
|
||||
"description": "The modern build of lodash’s `_.sum` as a module.",
|
||||
"homepage": "https://lodash.com/",
|
||||
"icon": "https://lodash.com/icon.svg",
|
||||
|
||||
Reference in New Issue
Block a user