@writetome51/is-empty-not-empty
TypeScript icon, indicating that this package has built-in type declarations

2.0.2 • Public • Published

isEmpty(arg): boolean

Returns true if arg.length === 0.

notEmpty(arg): boolean

Returns true if arg.length !== 0.

Examples

isEmpty([]);
// --> true

isEmpty('');
// --> true

isEmpty({length: 0});
// --> true

isEmpty({length: -1});
// --> false 

isEmpty();
// TypeError: "Cannot read property 'length' of undefined"

isEmpty(0);
// Error: "Input must have a 'length' property"

notEmpty([0]);
// --> true

notEmpty('  ');
// --> true

notEmpty({length: -1})
// --> true

notEmpty();
// TypeError: "Cannot read property 'length' of undefined"

notEmpty(1);
// Error: "Input must have a 'length' property"

Installation

npm i @writetome51/is-empty-not-empty

Loading

import { isEmpty, notEmpty } from '@writetome51/is-empty-not-empty';

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 2.0.2
    0
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 2.0.2
    0
  • 2.0.1
    1
  • 2.0.0
    0
  • 1.0.0
    7

Package Sidebar

Install

npm i @writetome51/is-empty-not-empty

Weekly Downloads

8

Version

2.0.2

License

MIT

Unpacked Size

3.02 kB

Total Files

5

Last publish

Collaborators

  • writetome51