isLength
Checks whether a value is a valid array-like length: a non-negative safe integer
(0 <= value <= Number.MAX_SAFE_INTEGER).
Available since v3.0.3
Import
Section titled “Import”Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
value | unknown | The value to check |
Returns
Section titled “Returns”value is number — true if value is a valid length
Examples
Section titled “Examples”Validate an array-like length before indexing
Section titled “Validate an array-like length before indexing”Guards against negative, fractional, or unsafe length values.
