UNPKG

just-is-empty

Version:

return true if object has no enumerable key values

43 lines (36 loc) 1.13 kB
<!-- DO NOT EDIT THIS FILE! THIS FILE WAS AUTOGENERATED BY TEMPLATE-MATE --> <!-- SEE https://github.com/angus-c/just/blob/master/CONTRIBUTING.md#readme-template --> ## just-is-empty Part of a [library](https://anguscroll.com/just) of zero-dependency npm modules that do just do one thing. Guilt-free utilities for every occasion. [`🍦 Try it`](https://anguscroll.com/just/just-is-empty) ```shell npm install just-is-empty ``` ```shell yarn add just-is-empty ``` Return true if object has no enumerable key values ```js import isEmpty from 'just-is-empty'; isEmpty({a: 3, b: 5}) // false isEmpty([1, 2]) // false isEmpty(new Set([1, 2, 2])) // false isEmpty((new Map()).set('a', 2)) // false isEmpty({}) // true isEmpty([]) // true isEmpty(new Set()) // true isEmpty(new Map()) // true isEmpty('abc') // false isEmpty('') // true isEmpty(0) // true isEmpty(1) // true isEmpty(true) // true isEmpty(Symbol('abc')); // true isEmpty(//); // true isEmpty(new String('abc')); // false isEmpty(new String('')); // true isEmpty(new Boolean(true)); // true isEmpty(null) // true isEmpty(undefined) // true ```