UNPKG

587 BJavaScriptView Raw
1import _curry1 from "./internal/_curry1.js";
2import _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
19var length =
20/*#__PURE__*/
21_curry1(function length(list) {
22 return list != null && _isNumber(list.length) ? list.length : NaN;
23});
24
25export default length;
\No newline at end of file