1.0.5 • Published 6 years ago

has-empty-property v1.0.5

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

has-empty-property NPM version Travis

Returns true if the object and array do not have a property, or exsiting a empty property.

Please consider following this project's author, Hopper Sun, and consider starring the project to show your :heart: and support.

Install

Install with npm:

$ npm install --save has-empty-property

Usage

const hasEmptyProperty = require('has-empty-property');

See the tests for more examples.

true

hasEmptyProperty({a: undefined, b:'1'});       // true
hasEmptyProperty({a: null, b:'1'});            // true
hasEmptyProperty({a: '', b:'1'});              // true
hasEmptyProperty({});                          // true
hasEmptyProperty([null, 1]);                   // true
hasEmptyProperty([]);                          // true

False

Everything else is false, as you would expect:

hasEmptyProperty({a: '0', b:'1'});             // false
hasEmptyProperty({a: ' ', b:'1'});             // false
hasEmptyProperty({a: 'null', b:'1'});          // false
hasEmptyProperty({a: 0, b:'1'});               // false
hasEmptyProperty({a: true, b:'1'});            // false
hasEmptyProperty([0, '11']);                   // false
hasEmptyProperty(['null', 'undefined']);       // false

About

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:

$ npm install && npm test

License

Copyright © 2018, Hopper Sun. Released under the MIT License.