diff options
Diffstat (limited to 'tools/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/internal/arraySum.js')
-rw-r--r-- | tools/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/internal/arraySum.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tools/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/internal/arraySum.js b/tools/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/internal/arraySum.js new file mode 100644 index 0000000000..59ccd999c3 --- /dev/null +++ b/tools/eslint/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/internal/arraySum.js @@ -0,0 +1,18 @@ +/** + * A specialized version of `_.sum` for arrays without support for iteratees. + * + * @private + * @param {Array} array The array to iterate over. + * @returns {number} Returns the sum. + */ +function arraySum(array) { + var length = array.length, + result = 0; + + while (length--) { + result += +array[length] || 0; + } + return result; +} + +module.exports = arraySum; |