Function
isEmpty (obj) Boolean public
Module: | @ember/utils |
---|
Defined in packages/@ember/-internals/metal/lib/is_empty.ts:5
import { isEmpty } from '@ember/utils';
- 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.
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
© 2020 Yehuda Katz, Tom Dale and Ember.js contributors
Licensed under the MIT License.
https://api.emberjs.com/ember/3.25/functions/@ember%2Futils/isEmpty