1 var baseClamp = require('./_baseClamp'),
2 toInteger = require('./toInteger');
4 /** Used as references for the maximum length and index of an array. */
5 var MAX_ARRAY_LENGTH = 4294967295;
8 * Converts `value` to an integer suitable for use as the length of an
11 * **Note:** This method is based on
12 * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
18 * @param {*} value The value to convert.
19 * @returns {number} Returns the converted integer.
25 * _.toLength(Number.MIN_VALUE);
28 * _.toLength(Infinity);
34 function toLength(value) {
35 return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
38 module.exports = toLength;