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 ❤️ and support.
Install with npm:
$ npm install --save has-empty-property
const hasEmptyProperty = require('has-empty-property');
See the tests for more examples.
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
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
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Running Tests
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
Copyright © 2018, Hopper Sun. Released under the MIT License.