Function

Module: @ember/utils

Available since v3.1.3

obj
Object
Value to test
returns
Boolean

Verifies that a value is null or undefined, an empty string, or an empty array.

Constrains the rules on isNone by returning true for empty strings and empty arrays.

If the value is an object with a size property of type number, it is used to check emptiness.

1
2
3
4
5
6
7
8
9
10
11
12
13
isEmpty();                 // true
isEmpty(null);             // true
isEmpty(undefined);        // true
isEmpty('');               // true
isEmpty([]);               // true
isEmpty({ size: 0});       // true
isEmpty({});               // false
isEmpty('Adam Hawkins');   // false
isEmpty([0,1,2]);          // false
isEmpty('\n\t');           // false
isEmpty('  ');             // false
isEmpty({ size: 1 })       // false
isEmpty({ size: () => 0 }) // false