Skip to content

2 javascript functions that check if the argument has a 'length' property with a value of 0

License

Notifications You must be signed in to change notification settings

writetome51/is-empty-not-empty

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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';

About

2 javascript functions that check if the argument has a 'length' property with a value of 0

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published