Skip to content

isEmpty

Static Badge

Check if the input parameter is an empty value, including undefined, null, NaN, '' and array with length of 0.

Added in v0.0.6

Usage

ts
import { isEmpty } from 'parsnip-kit'

isEmpty(undefined) // true
isEmpty(null) // true
isEmpty(NaN) // true
isEmpty('') // true
isEmpty([]) // true

isEmpty([1, 2, 3]) // false
isEmpty({ key: 'value' }) // false

API

Arguments

ArgTypeOptionalDefaultDescription
arganyfalseundefinedThe argument to check

Returns

Type
boolean