MCPcopy
hub / github.com/lodash/lodash / toLength

Function toLength

lodash.js:12529–12531  ·  view source on GitHub ↗

* Converts `value` to an integer suitable for use as the length of an * array-like object. * * **Note:** This method is based on * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). * * @static * @memberOf _ * @since 4.0.0 * @category

(value)

Source from the content-addressed store, hash-verified

12527 * // => 3
12528 */
12529 function toLength(value) {
12530 return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
12531 }
12532
12533 /**
12534 * Converts `value` to a number.

Callers 1

baseFillFunction · 0.85

Calls 2

baseClampFunction · 0.85
toIntegerFunction · 0.85

Tested by

no test coverage detected