isEmpty

View source
object Object

Usage

Check whether a value is empty. The following values are considered empty:

  • null
  • undefined
  • empty string ('')
  • empty array ([])
  • empty object ({})
import { isEmpty } from '@movk/core'

isEmpty(null) // => true
isEmpty('') // => true
isEmpty([]) // => true
isEmpty({}) // => true

isEmpty(0) // => false
isEmpty('hello') // => false
isEmpty([1]) // => false

API

isEmpty(value: any): boolean

Parameters

value
any required
The value to check.

Returns

boolean
Returns true if the value is considered empty, otherwise false.

Changelog

No recent changes
Copyright © 2024 - 2026 YiXuan - MIT License