| [a762898] | 1 | /**
|
|---|
| 2 | * Checks if the given value is an array.
|
|---|
| 3 | *
|
|---|
| 4 | * This function tests whether the provided value is an array or not.
|
|---|
| 5 | * It returns `true` if the value is an array, and `false` otherwise.
|
|---|
| 6 | *
|
|---|
| 7 | * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to an array.
|
|---|
| 8 | *
|
|---|
| 9 | * @param {any} value - The value to test if it is an array.
|
|---|
| 10 | * @returns {value is any[]} `true` if the value is an array, `false` otherwise.
|
|---|
| 11 | *
|
|---|
| 12 | * @example
|
|---|
| 13 | * const value1 = [1, 2, 3];
|
|---|
| 14 | * const value2 = 'abc';
|
|---|
| 15 | * const value3 = () => {};
|
|---|
| 16 | *
|
|---|
| 17 | * console.log(isArray(value1)); // true
|
|---|
| 18 | * console.log(isArray(value2)); // false
|
|---|
| 19 | * console.log(isArray(value3)); // false
|
|---|
| 20 | */
|
|---|
| 21 | declare function isArray(value?: any): value is any[];
|
|---|
| 22 | /**
|
|---|
| 23 | * Checks if the given value is an array with generic type support.
|
|---|
| 24 | *
|
|---|
| 25 | * This function tests whether the provided value is an array or not.
|
|---|
| 26 | * It returns `true` if the value is an array, and `false` otherwise.
|
|---|
| 27 | *
|
|---|
| 28 | * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to an array.
|
|---|
| 29 | *
|
|---|
| 30 | * @template T - The type of elements in the array.
|
|---|
| 31 | * @param {any} value - The value to test if it is an array.
|
|---|
| 32 | * @returns {value is any[]} `true` if the value is an array, `false` otherwise.
|
|---|
| 33 | *
|
|---|
| 34 | * @example
|
|---|
| 35 | * const value1 = [1, 2, 3];
|
|---|
| 36 | * const value2 = 'abc';
|
|---|
| 37 | * const value3 = () => {};
|
|---|
| 38 | *
|
|---|
| 39 | * console.log(isArray<number>(value1)); // true
|
|---|
| 40 | * console.log(isArray<string>(value2)); // false
|
|---|
| 41 | * console.log(isArray<Function>(value3)); // false
|
|---|
| 42 | */
|
|---|
| 43 | declare function isArray<T>(value?: any): value is any[];
|
|---|
| 44 |
|
|---|
| 45 | export { isArray };
|
|---|