source: node_modules/es-toolkit/dist/compat/math/sum.d.mts

Last change on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago

Added visualizations

  • Property mode set to 100644
File size: 532 bytes
Line 
1/**
2 * Computes the sum of the values that are returned by the `iteratee` function.
3 *
4 * It does not coerce values to `number`.
5 *
6 * @param {ArrayLike<any> | null | undefined} array - The array to iterate over.
7 * @returns {number} Returns the sum.
8 *
9 * @example
10 * sum([1, 2, 3]); // => 6
11 * sum([1n, 2n, 3n]); // => 6n
12 * sum(["1", "2"]); // => "12"
13 * sum([1, undefined, 2]); // => 3
14 * sum(null); // => 0
15 * sum(undefined); // => 0
16 */
17declare function sum(array: ArrayLike<any> | null | undefined): number;
18
19export { sum };
Note: See TracBrowser for help on using the repository browser.