@ngard/tiny-isempty
v1.0.0
Published
A minimal-weight lodash.isEmpty equivalent utility
Downloads
2
Readme
tiny-isempty
A minimal-weight utility equivalent to lodash.isempty
. For when every byte counts!
Syntax
isEmpty(/* object */)
Parameters
object
- The object to check for emptiness
Return
true
if value is an empty object, collection, map, or set. false
otherwise.
Objects are considered empty if they have no own enumerable string keyed properties.
Array-like values such as arguments
objects, arrays
, strings
, or jQuery-like collections are considered empty if they have a length of 0
. Similarly, maps
and sets
are considered empty if they have a size of 0
.
Example
import { isEmpty } from '@ngard/tiny-isempty';
isEmpty({}); // true
isEmpty([]); // true
isEmpty(''); // true
isEmpty(new Map()); // true
isEmpty(Object.create(null)); // true