{"name":"has-value","description":"Returns true if a value exists, false if empty. Works with deeply nested values using object paths.","version":"0.2.1","homepage":"https://github.com/jonschlinkert/has-value","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git+https://github.com/jonschlinkert/has-value.git"},"bugs":{"url":"https://github.com/jonschlinkert/has-value/issues"},"license":"MIT","files":["index.js"],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha"},"dependencies":{"get-value":"^2.0.0","has-values":"^0.1.3"},"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"],"verb":{"related":{"description":"","list":["get-value","set-value","get-property","get-object"]}},"gitHead":"0e50bd07b986ac899a5f72e1428f1641f7bf6030","_id":"has-value@0.2.1","_shasum":"dbb14da140d429a8bcd4f089bc190f7db30bef70","_from":".","_npmVersion":"2.14.7","_nodeVersion":"4.2.1","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"shasum":"dbb14da140d429a8bcd4f089bc190f7db30bef70","tarball":"http://registry-npm.ywwl.com/has-value/download/has-value-0.2.1.tgz","integrity":"sha512-fGWNETB2JNlWk9Lcwmpj/27UZJnROnwnl3nKRl24CriGjuQP1UeCjEDxfqA0v0NyriAXnw3qFdET195atNv7KQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIB1XpoK6L9gy7tg+JEIbk8xQgId6+5Nhy1eopmwLXZ0qAiAWAWflqaOWPagL2XqbFNUgAeK81rZj4mt4SXbsk6pekg=="}],"size":2499,"noattachment":false,"key":"/has-value/-/has-value-0.2.1.tgz"},"directories":{},"readme":"# has-value [![NPM version](https://img.shields.io/npm/v/has-value.svg?style=flat)](https://www.npmjs.com/package/has-value) [![NPM monthly downloads](https://img.shields.io/npm/dm/has-value.svg?style=flat)](https://npmjs.org/package/has-value) [![NPM total downloads](https://img.shields.io/npm/dt/has-value.svg?style=flat)](https://npmjs.org/package/has-value) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/has-value.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/has-value)\n\n> Returns true if a value exists, false if empty. Works with deeply nested values using object paths.\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-value\n```\n\n## Heads up!\n\nBreaking changes in v2.0! See the [release history](#release-history) for details.\n\n## Usage\n\n```js\nconst has = require('has-value');\n\nconsole.log(has()) //=> true\nconsole.log(has('foo')) //=> true\n```\n\n**Works for:**\n\n* booleans\n* functions\n* numbers\n* strings\n* nulls\n* object\n* arrays\n\n**isEmpty**\n\nTo do the opposite and test for empty values, do:\n\n```js\nconst isEmpty = (...args) => !has(...args);\n```\n\n## Supported types\n\n### Arrays\n\n```js\nconsole.log(has({ foo: { bar: ['a'] } }, 'foo.bar'));    //=> true\nconsole.log(has({ foo: { bar: [0] } }, 'foo.bar'));      //=> true\nconsole.log(has({ foo: { bar: [[[]]] } }, 'foo.bar'));   //=> false\nconsole.log(has({ foo: { bar: [[], []] } }, 'foo.bar')); //=> false\nconsole.log(has({ foo: { bar: [] } }, 'foo.bar'));       //=> false\n```\n\n### Booleans\n\n```js\nconsole.log(has({ foo: { bar: true } }, 'foo.bar'));  //=> true\nconsole.log(has({ foo: { bar: false } }, 'foo.bar')); //=> true\n```\n\n### Buffers\n\n```js\nconsole.log(has({ foo: { bar: new Buffer() } }, 'foo.bar'));      //=> false\nconsole.log(has({ foo: { bar: new Buffer('foo') } }, 'foo.bar')); //=> true\n```\n\n### Dates\n\nDates are always true.\n\n```js\nconsole.log(has({ foo: { bar: new Date() } }, 'foo.bar')); //=> true\n```\n\n### Errors\n\nReturns `false` if `err.message` is an empty string.\n\n```js\nconsole.log(has({ foo: { bar: new Error() } }, 'foo.bar'));      //=> false\nconsole.log(has({ foo: { bar: new Error('foo') } }, 'foo.bar')); //=> true\n```\n\n### Functions\n\nFunctions are always true.\n\n```js\nconsole.log(has({ foo: { bar: function(foo) {} } }, 'foo.bar')); //=> true\nconsole.log(has({ foo: { bar: function() {} } }, 'foo.bar'));    //=> true\n```\n\n### Maps\n\n```js\nconsole.log(has({ foo: { bar: new Map() } }, 'foo.bar'));                 //=> false\nconsole.log(has({ foo: { bar: new Map([['foo', 'bar']]) } }, '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({ foo: { bar: null } }, 'foo.bar')); //=> true\n```\n\n### Objects\n\n```js\nconsole.log(has({ foo: { bar: {} } }, 'foo.bar')); //=> false\nconsole.log(has({ foo: { bar: { a: 'a' }} } }, 'foo.bar'));        //=> true\nconsole.log(has({ foo: { bar: { foo: undefined } } }, 'foo.bar')); //=> false\nconsole.log(has({ foo: { bar: { foo: null } } }, 'foo.bar'));      //=> true\n```\n\n### Numbers\n\n```js\nconsole.log(has({ foo: { bar: 1 } }, 'foo.bar')); //=> true\nconsole.log(has({ foo: { bar: 0 } }, 'foo.bar')); //=> true\n```\n\n### Regular expressions\n\n```js\nconsole.log(has({ foo: { bar: new RegExp() } }, 'foo.bar'));      //=> false\nconsole.log(has({ foo: { bar: new RegExp('foo') } }, 'foo.bar')); //=> true\n```\n\n### Sets\n\n```js\nconsole.log(has({ foo: { bar: new Set() } }, 'foo.bar'));               //=> false\nconsole.log(has({ foo: { bar: new Set(['foo', 'bar']) } }, 'foo.bar')); //=> true\n```\n\n### Strings\n\n```js\nconsole.log(has({ foo: { bar: 'a' } }, 'foo.bar')); //=> true\nconsole.log(has({ foo: { bar: '' } }, 'foo.bar'));  //=> false\n```\n\n## Undefined\n\n```js\nconsole.log(has({ foo: { bar:  } }, 'foo.bar'));          //=> false\nconsole.log(has({ foo: { bar: void 0 } }, 'foo.bar'));    //=> false\nconsole.log(has({ foo: { bar: undefined } }, 'foo.bar')); //=> false\n```\n\n## Release history\n\n### v2.0.0\n\n**Breaking changes**\n\n* Now returns false if the first argument is not an object, function or array, and the second argument is not a string or array.\n\n### v1.0.0\n\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* [define-property](https://www.npmjs.com/package/define-property): Define a non-enumerable property on an object. Uses Reflect.defineProperty when available, otherwise Object.defineProperty. | [homepage](https://github.com/jonschlinkert/define-property \"Define a non-enumerable property on an object. Uses Reflect.defineProperty when available, otherwise Object.defineProperty.\")\n* [get-value](https://www.npmjs.com/package/get-value): Use property paths like 'a.b.c' to get a nested value from an object. Even works… [more](https://github.com/jonschlinkert/get-value) | [homepage](https://github.com/jonschlinkert/get-value \"Use property paths like 'a.b.c' to get a nested value from an object. Even works when keys have dots in them (no other dot-prop library can do this!).\")\n* [set-value](https://www.npmjs.com/package/set-value): Create nested values and any intermediaries using dot notation (`'a.b.c'`) paths. | [homepage](https://github.com/jonschlinkert/set-value \"Create nested values and any intermediaries using dot notation (`'a.b.c'`) paths.\")\n* [unset-value](https://www.npmjs.com/package/unset-value): Delete nested properties from an object using dot notation. | [homepage](https://github.com/jonschlinkert/unset-value \"Delete nested properties from an object using dot notation.\")\n\n### Contributors\n\n| **Commits** | **Contributor** | \n| --- | --- |\n| 32 | [jonschlinkert](https://github.com/jonschlinkert) |\n| 2 | [rmharrison](https://github.com/rmharrison) |\n| 1 | [wtgtybhertgeghgtwtg](https://github.com/wtgtybhertgeghgtwtg) |\n\n### Author\n\n**Jon Schlinkert**\n\n* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert)\n* [GitHub Profile](https://github.com/jonschlinkert)\n* [Twitter Profile](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 March 03, 2018._","publish_time":1446234806993,"_cnpm_publish_time":1446234806993,"dist-tags":{"latest":"2.0.2"}}