source: imaps-frontend/node_modules/lodash-es/sum.js@ d565449

main
Last change on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 451 bytes
Line 
1import baseSum from './_baseSum.js';
2import identity from './identity.js';
3
4/**
5 * Computes the sum of the values in `array`.
6 *
7 * @static
8 * @memberOf _
9 * @since 3.4.0
10 * @category Math
11 * @param {Array} array The array to iterate over.
12 * @returns {number} Returns the sum.
13 * @example
14 *
15 * _.sum([4, 2, 8, 6]);
16 * // => 20
17 */
18function sum(array) {
19 return (array && array.length)
20 ? baseSum(array, identity)
21 : 0;
22}
23
24export default sum;
Note: See TracBrowser for help on using the repository browser.