source: node_modules/es-toolkit/dist/predicate/isLength.d.ts

Last change on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago

Added visualizations

  • Property mode set to 100644
File size: 843 bytes
RevLine 
[a762898]1/**
2 * Checks if a given value is a valid length.
3 *
4 * A valid length is of type `number`, is a non-negative integer, and is less than or equal to
5 * JavaScript's maximum safe integer (`Number.MAX_SAFE_INTEGER`).
6 * It returns `true` if the value is a valid length, and `false` otherwise.
7 *
8 * This function can also serve as a type predicate in TypeScript, narrowing the type of the
9 * argument to a valid length (`number`).
10 *
11 * @param {any} value The value to check.
12 * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
13 *
14 * @example
15 * isLength(0); // true
16 * isLength(42); // true
17 * isLength(-1); // false
18 * isLength(1.5); // false
19 * isLength(Number.MAX_SAFE_INTEGER); // true
20 * isLength(Number.MAX_SAFE_INTEGER + 1); // false
21 */
22declare function isLength(value?: any): boolean;
23
24export { isLength };
Note: See TracBrowser for help on using the repository browser.