Skip to content

isEmpty() function

Returns true if the given value is empty value, false otherwise.

Signature:

typescript
isEmpty: <T>(value: T) => boolean

Example

ts
isEmpty({}) // true
isEmpty([]) // true
isEmpty(null) // true
isEmpty(undefined) // true
isEmpty("") // true
isEmpty(new Map()) // true
isEmpty(new Set()) // true

isEmpty(0) // false
isEmpty(false) // false
isEmpty(function(){}) // false
isEmpty(Symbol("")) // false
isEmpty(new Date()) // false

Open Source Code

Released under the Apache-2.0 License.