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 [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).
16 * @param {*} value The value to convert.
17 * @returns {number} Returns the converted integer.
23 * _.toLength(Number.MIN_VALUE);
26 * _.toLength(Infinity);
32 function toLength(value) {
33 return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
36 module.exports = toLength;