isLength es-toolkit
Checks if a value is a valid array length.
Usage
isLength(value)
Use isLength when you want to check if a value is a valid array length. A valid length must be an integer between 0 and Number.MAX_SAFE_INTEGER.
Can also be used as a type guard in TypeScript.
Parameters
valueunknownrequired
The value to check if it's a valid length.
Returns
Returns true if the value is a valid length, false otherwise.
Source: es-toolkit
Re-exported verbatim from es-toolkit. Implementation, edge cases, and performance behavior are owned upstream. This page mirrors the documentation at the pinned version; the linked source is authoritative.