{"name":"has-values","description":"Returns true if a value exists, false if empty. Works for booleans, functions, numbers, strings, nulls, objects and arrays. Other libs do this, but I needed one that would optionally _not_ treat zero as empty. Also, this works with booleans and other valu","version":"0.1.2","homepage":"https://github.com/jonschlinkert/has-values","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git://github.com/jonschlinkert/has-values.git"},"bugs":{"url":"https://github.com/jonschlinkert/has-values/issues"},"license":{"type":"MIT","url":"https://github.com/jonschlinkert/has-values/blob/master/LICENSE"},"files":["index.js"],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha"},"devDependencies":{"mocha":"*","should":"^4.0.4"},"keywords":["array","boolean","empty","find","function","has","hasOwn","javascript","js","key","keys","node.js","null","number","object","properties","property","string","type","util","utilities","utility","value"],"gitHead":"9e6e72d2d2d41c67131051eaa5c940d67f5b965f","_id":"has-values@0.1.2","_shasum":"804a721f892a31ee86ae118109fdacaafae6bcf3","_from":".","_npmVersion":"2.7.1","_nodeVersion":"1.6.2","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"shasum":"804a721f892a31ee86ae118109fdacaafae6bcf3","tarball":"http://registry-npm.ywwl.com/has-values/download/has-values-0.1.2.tgz","integrity":"sha512-NCTg2V0wTyLDwhe2UKgYjEFYc1x+uZ/j8dEC2gzexzxjja8V4U+JgEpOvdMHl3UkDL5Ko9qlp49WVlQhUd4HcQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIC1CuQzVdAzhjVeBvyviTTHfxjMLvUeK/OFLPFHkRUjtAiEAslfAft45X95t1F6sCjEbB+/de6RPVNsassTCM3R2ES0="}],"size":2083,"noattachment":false,"key":"/has-values/-/has-values-0.1.2.tgz"},"directories":{},"readme":"# has-values [![NPM version](https://img.shields.io/npm/v/has-values.svg?style=flat)](https://www.npmjs.com/package/has-values) [![NPM monthly downloads](https://img.shields.io/npm/dm/has-values.svg?style=flat)](https://npmjs.org/package/has-values) [![NPM total downloads](https://img.shields.io/npm/dt/has-values.svg?style=flat)](https://npmjs.org/package/has-values) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/has-values.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/has-values)\n\n> Returns true if any values exist, false if empty. Works for booleans, functions, numbers, strings, nulls, objects and arrays.\n\nPlease consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.\n\n## Install\n\nInstall with [npm](https://www.npmjs.com/):\n\n```sh\n$ npm install --save has-values\n```\n\n## Usage\n\n```js\nconst has = require('has-values');\n```\n\nCreate an `isEmpty` function by returning the inverse of the result from has-values:\n\n```js\nconst isEmpty = val => !has(val);\n```\n\n## Supported types\n\n### Arrays\n\n```js\nconsole.log(has(['a']));      //=> true\nconsole.log(has([0]));        //=> true\nconsole.log(has([[[]]]));     //=> false\nconsole.log(has([[], []]));   //=> false\nconsole.log(has([]));         //=> false\n```\n\n### Booleans\n\n```js\nconsole.log(has(true));  //=> true\nconsole.log(has(false)); //=> true\n```\n\n### Buffers\n\n```js\nconsole.log(has(new Buffer()));      //=> false\nconsole.log(has(new Buffer('foo'))); //=> true\n```\n\n### Dates\n\nDates are always true.\n\n```js\nconsole.log(has(new Date())); //=> true\n```\n\n### Errors\n\nReturns `false` if `err.message` is an empty string.\n\n```js\nconsole.log(has(new Error()));      //=> false\nconsole.log(has(new Error('foo'))); //=> true\n```\n\n### Functions\n\nFunctions are always true.\n\n```js\nconsole.log(has(function(foo) {})); //=> true\nconsole.log(has(function() {}));    //=> true\n```\n\n### Maps\n\n```js\nconsole.log(has(new Map()));                 //=> false\nconsole.log(has(new Map([['foo', 'bar']]))); //=> true\n```\n\n### Null\n\n`null` is always true, as it's assumed that this is a user-defined value, versus `undefined` which is not.\n\n```js\nconsole.log(has(null)); //=> true\n```\n\n### Objects\n\n```js\nconsole.log(has({})); //=> false\nconsole.log(has({ a: 'a' }}));        //=> true\nconsole.log(has({ foo: undefined })); //=> false\nconsole.log(has({ foo: null }));      //=> true\n```\n\n### Numbers\n\n```js\nconsole.log(has(1)); //=> true\nconsole.log(has(0)); //=> true\n```\n\n### Regular expressions\n\n```js\nconsole.log(has(new RegExp()));      //=> false\nconsole.log(has(new RegExp('foo'))); //=> true\n```\n\n### Sets\n\n```js\nconsole.log(has(new Set()));               //=> false\nconsole.log(has(new Set(['foo', 'bar']))); //=> true\n```\n\n### Strings\n\n```js\nconsole.log(has('a')); //=> true\nconsole.log(has(''));  //=> false\n```\n\n## Undefined\n\n```js\nconsole.log(has());          //=> false\nconsole.log(has(void 0));    //=> false\nconsole.log(has(undefined)); //=> false\n```\n\n## Release history\n\n### v2.0.0\n\n* no longer supports numbers as a string\n* optimizations\n* adds support for `regex` and `buffer`\n\n### v1.0.0\n\n* adds support for `Map` and `Set`\n* `zero` always returns true\n* `array` now recurses, so that an array of empty arrays will return `false`\n* `null` now returns true\n\n## About\n\n<details>\n<summary><strong>Contributing</strong></summary>\n\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).\n\n</details>\n\n<details>\n<summary><strong>Running Tests</strong></summary>\n\nRunning 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:\n\n```sh\n$ npm install && npm test\n```\n\n</details>\n\n<details>\n<summary><strong>Building docs</strong></summary>\n\n_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_\n\nTo generate the readme, run the following command:\n\n```sh\n$ npm install -g verbose/verb#dev verb-generate-readme && verb\n```\n\n</details>\n\n### Related projects\n\nYou might also be interested in these projects:\n\n* [has-value](https://www.npmjs.com/package/has-value): Returns true if a value exists, false if empty. Works with deeply nested values using… [more](https://github.com/jonschlinkert/has-value) | [homepage](https://github.com/jonschlinkert/has-value \"Returns true if a value exists, false if empty. Works with deeply nested values using object paths.\")\n* [is-number](https://www.npmjs.com/package/is-number): Returns true if the value is a number. comprehensive tests. | [homepage](https://github.com/jonschlinkert/is-number \"Returns true if the value is a number. comprehensive tests.\")\n* [is-plain-object](https://www.npmjs.com/package/is-plain-object): Returns true if an object was created by the `Object` constructor. | [homepage](https://github.com/jonschlinkert/is-plain-object \"Returns true if an object was created by the `Object` constructor.\")\n* [isobject](https://www.npmjs.com/package/isobject): Returns true if the value is an object and not an array or null. | [homepage](https://github.com/jonschlinkert/isobject \"Returns true if the value is an object and not an array or null.\")\n* [kind-of](https://www.npmjs.com/package/kind-of): Get the native type of a value. | [homepage](https://github.com/jonschlinkert/kind-of \"Get the native type of a value.\")\n\n### Author\n\n**Jon Schlinkert**\n\n* [linkedin/in/jonschlinkert](https://linkedin.com/in/jonschlinkert)\n* [github/jonschlinkert](https://github.com/jonschlinkert)\n* [twitter/jonschlinkert](https://twitter.com/jonschlinkert)\n\n### License\n\nCopyright © 2018, [Jon Schlinkert](https://github.com/jonschlinkert).\nReleased under the [MIT License](LICENSE).\n\n***\n\n_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on January 30, 2018._","publish_time":1427249600984,"_cnpm_publish_time":1427249600984,"dist-tags":{"latest":"2.0.1"}}