UNPKG

es-toolkit

Version:

A state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations.

27 lines (26 loc) 779 B
//#region src/compat/predicate/isArray.ts /** * Checks if the given value is an array. * * This function tests whether the provided value is an array or not. * It returns `true` if the value is an array, and `false` otherwise. * * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to an array. * * @param value - The value to test if it is an array. * @returns `true` if the value is an array, `false` otherwise. * * @example * const value1 = [1, 2, 3]; * const value2 = 'abc'; * const value3 = () => {}; * * console.log(isArray(value1)); // true * console.log(isArray(value2)); // false * console.log(isArray(value3)); // false */ function isArray(value) { return Array.isArray(value); } //#endregion exports.isArray = isArray;