basant307/AI_Governance_Project
045
1var baseClamp = require('./_baseClamp'),2 toInteger = require('./toInteger');3 4/** Used as references for the maximum length and index of an array. */5var MAX_ARRAY_LENGTH = 4294967295;6 7/**8 * Converts `value` to an integer suitable for use as the length of an9 * array-like object.10 *11 * **Note:** This method is based on12 * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).13 *14 * @static15 * @memberOf _16 * @since 4.0.017 * @category Lang18 * @param {*} value The value to convert.19 * @returns {number} Returns the converted integer.20 * @example21 *22 * _.toLength(3.2);23 * // => 324 *25 * _.toLength(Number.MIN_VALUE);26 * // => 027 *28 * _.toLength(Infinity);29 * // => 429496729530 *31 * _.toLength('3.2');32 * // => 333 */34function toLength(value) {35 return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;36}37 38module.exports = toLength;39 