validate.io-empty

Validates if a value is empty.

Showing:

Popularity

Downloads/wk

2

GitHub Stars

2

Maintenance

Last Commit

7yrs ago

Contributors

0

Package

Dependencies

3

License

Type Definitions

Tree-Shakeable

No?

Categories

Readme

Empty

NPM version Build Status Coverage Status Dependencies

Validates if a value is empty.

Installation

$ npm install validate.io-empty

For use in the browser, use browserify.

Usage

var isEmpty = require( 'validate.io-empty' );

isEmpty( value )

Validates if a value is empty.

var value = {};

var bool = isEmpty( value );
// returns true

Note: the method only applies to string, array, and object value types. For everything else, the method returns false.

Examples

console.log( isEmpty( {} ) );
// returns true

console.log( isEmpty( [] ) );
// returns true

console.log( isEmpty( '' ) );
// returns true

console.log( isEmpty( null ) );
// returns false

To run the example code from the top-level application directory,

$ node ./examples/index.js

Tests

Unit

Unit tests use the Mocha test framework with Chai assertions. To run the tests, execute the following command in the top-level application directory:

$ make test

All new feature development should have corresponding unit tests to validate correct functionality.

Test Coverage

This repository uses Istanbul as its code coverage tool. To generate a test coverage report, execute the following command in the top-level application directory:

$ make test-cov

Istanbul creates a ./reports/coverage directory. To access an HTML version of the report,

$ make view-cov

License

MIT license.

Copyright © 2014. Athan Reines.

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial