prod.js

  1. import { curry, filter, product } from "ramda"
  2. import isNumeric from "./internal/isNumeric"
  3. /**
  4. * Product of series.
  5. *
  6. * @func
  7. * @memberOf Z
  8. * @category Analysis
  9. * @param {Array} arr Array of values
  10. * @return {Number}
  11. * @example
  12. *
  13. * const series = [7, 2, 30, 56, 75]
  14. * Z.prod(series)
  15. * // 1764000
  16. */
  17. const prod = curry(arr => {
  18. const filteredArr = filter(isNumeric, arr)
  19. return product(filteredArr)
  20. })
  21. export default prod