Miss any of our Open RFC calls?Watch the recordings here! »

is-present

1.0.0 • Public • Published

is-present Build Status

Check whether a value is nonblank.

Installation

npm i --save is-present

Usage

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

Acknowledgements

A negation for is-blank which extends is-empty and is-whitespace.

License

MIT

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Crafted with <3 by John Otander (@4lpine).

Install

npm i is-present

DownloadsWeekly Downloads

15,328

Version

1.0.0

License

MIT

Last publish

Collaborators

  • avatar