Skip to content

isArray

Checks if a value is an array.

Available since v1.9.0

import { isArray } from '@helpers4/guard';
// or, from the all-in-one package (same code, one install):
import { isArray } from 'helpers4/guard';
isArray(value: unknown): value is unknown[]
ParameterTypeDescription
valueunknownThe value to check

value is unknown[] — True if value is an array

isArray([1, 2, 3]) // => true
isArray('hello')   // => false
isArray({})        // => false

View source on GitHub