You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
587 B

4 years ago
  1. import _curry1 from "./internal/_curry1.js";
  2. import _isNumber from "./internal/_isNumber.js";
  3. /**
  4. * Returns the number of elements in the array by returning `list.length`.
  5. *
  6. * @func
  7. * @memberOf R
  8. * @since v0.3.0
  9. * @category List
  10. * @sig [a] -> Number
  11. * @param {Array} list The array to inspect.
  12. * @return {Number} The length of the array.
  13. * @example
  14. *
  15. * R.length([]); //=> 0
  16. * R.length([1, 2, 3]); //=> 3
  17. */
  18. var length =
  19. /*#__PURE__*/
  20. _curry1(function length(list) {
  21. return list != null && _isNumber(list.length) ? list.length : NaN;
  22. });
  23. export default length;