4.17.11
3.10.1
2.4.2
1.3.1

_.toLength(value)

Converts value to an integer suitable for use as the length of an array-like object.

Note: This method is based on ToLength.

Since

4.0.0

Arguments

argument
value
type
*
description
The value to convert.

Returns

(array)

Example

_.toLength(3.2);
// => 3

_.toLength(Number.MIN_VALUE);
// => 0

_.toLength(Infinity);
// => 4294967295

_.toLength("3.2");
// => 3
_.toLength(3.2);
// => 3

_.toLength(Number.MIN_VALUE);
// => 0

_.toLength(Infinity);
// => 4294967295

_.toLength("3.2");
// => 3