to-length-x
v4.2.2
Published
Shim for ToLength.
Downloads
12,928
Maintainers
Readme
to-length-x
Shim for ToLength.
See: 7.1.15 ToLength ( argument )
module.exports(value)
⇒ * ⏏
to-length-x
⇒ *
Converts value
to an integer suitable for use as the length of an
array-like object. (ES2019)
Kind: static property of to-length-x
Returns: number - Returns the converted integer.
| Param | Type | Description | | ----- | --------------- | --------------------- | | value | * | The value to convert. |
Example
var toLength = require('to-length-x').toLength2018;
toLength(3); // 3
toLength(Number.MIN_VALUE); // 0
toLength(Infinity); // Number.MAX_SAFE_INTEGER
toLength('3'); // 3