Check whether a value is nonblank.
npm i --save is-present
var isPresent = require('is-present');
isPresent([]); // => false
isPresent({}); // => false
isPresent(0); // => false
isPresent(function(){}); // => false
isPresent(null); // => false
isPresent(undefined); // => false
isPresent(''); // => false
isPresent(' '); // => false
isPresent('\r\t\n '); // => false
isPresent(['a', 'b']); // => true
isPresent({ a: 'b' }); // => true
isPresent('string'); // => true
isPresent(42); // => true
isPresent(function(a,b){}); // => true
A negation for is-blank which extends is-empty and is-whitespace.
MIT
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
Crafted with <3 by John Otander (@4lpine).