is-empty
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/is-empty package

1.2.0 • Public • Published

is-empty

Check whether a value is empty.

Installation

$ npm install is-empty
$ npm test

Example

var empty = require('is-empty');
 
empty([]);              // true
empty({});              // true
empty('');              // true
empty(0);               // true
empty(function(){});    // true
empty(null);            // true
empty(undefined);       // true
empty(new Map());       // true
empty(new Set());       // true
empty(new Error());     // true
 
empty(true);            // false
empty(false);           // false
empty(['a', 'b']);      // false
empty({ a: 'b' });      // false
empty('string');        // false
empty(42);              // false
empty(function(a,b){}); // false
empty(new Map([['key', 'value']])); // false
empty(new Set([1]));    // false
empty(new Error('fail'))// false

API

isEmpty(value)

Check whether value is empty.

License

MIT

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.2.0446,430latest

Version History

VersionDownloads (Last 7 Days)Published
1.2.0446,430
1.1.010
1.0.06,737
0.1.04
0.0.116,771

Package Sidebar

Install

npm i is-empty

Weekly Downloads

469,952

Version

1.2.0

License

MIT

Last publish

Collaborators

  • ianstormtaylor
  • calvinfo