Learn more  » Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Bower components Debian packages RPM packages NuGet packages

skava / chain-able-deps   js

Repository URL to install this package:

Version: 6.0.4 

/ src / math / sum.ts

import reduce from '../loop/flipped/reduceArrayFlipped'
import add from './add'

/**
 * Adds together all the elements of a list.
 * @since 5.0.0-beta.5
 * @memberOf conditional
 *
 * @param {Array} list An array of numbers
 * @return {Number} The sum of all the numbers in the list.
 *
 * @func
 * @fork v0.1.0
 * @category Math
 * @sig [Number] -> Number
 *
 * {@link https://github.com/ramda/ramda/blob/master/src/sum.js ramda-sum}
 * {@link https://github.com/lodash/lodash/blob/master/sum.js lodash-sum}
 * @see {@link lodash-sum}
 * @see {@link ramda-sum}
 * @see loop/reduce
 *
 * @example
 *
 *      sum([2,4,6,8,100,1])
 *      //=> 121
 *
 */
export default reduce(add, 0)