function isEmpty
isEmpty(thing: unknown[]): boolean

Determines if the given thing is empty.

Things are empty when:

  • They are None
  • They are empty strings
  • They are strings of only whitespace
  • They have length or size

Examples

Example 1

isEmpty([]); // true
isEmpty([0]); // false
isEmpty(""); // true
isEmpty(" "); // true
isEmpty(new Set()); // true
isEmpty({}); // true
isEmpty(new Map()); // true

Parameters

thing: unknown[]

Return Type

boolean
isEmpty(thing: unknown): boolean

Parameters

thing: unknown

Return Type

boolean