1 # has-value [![NPM version](https://img.shields.io/npm/v/has-value.svg?style=flat)](https://www.npmjs.com/package/has-value) [![NPM downloads](https://img.shields.io/npm/dm/has-value.svg?style=flat)](https://npmjs.org/package/has-value) [![Build Status](https://img.shields.io/travis/jonschlinkert/has-value.svg?style=flat)](https://travis-ci.org/jonschlinkert/has-value)
3 > Returns true if a value exists, false if empty. Works with deeply nested values using object paths.
7 Install with [npm](https://www.npmjs.com/):
10 $ npm install has-value --save
17 * numbers (pass `true` as the last arg to treat zero as a value instead of falsey)
25 Works with nested object paths or a single value:
28 var hasValue = require('has-value');
30 hasValue({a: {b: {c: 'foo'}}} 'a.b.c');
45 hasValue(0, true); // pass `true` as the last arg to treat zero as a value
60 hasValue(function(foo) {}); // function length/arity
63 hasValue(function() {});
73 To do the opposite and test for empty values, do:
76 function isEmpty(o, isZero) {
77 return !hasValue.apply(hasValue, arguments);
83 You might also be interested in these projects:
85 * [get-object](https://www.npmjs.com/package/get-object): Get a property from an object using dot (object path) notation. | [homepage](https://github.com/jonschlinkert/get-object)
86 * [get-property](https://www.npmjs.com/package/get-property): Get a nested property or its value from an object using simple `a.b.c` paths. | [homepage](https://github.com/jonschlinkert/get-property)
87 * [get-value](https://www.npmjs.com/package/get-value): Use property paths (`a.b.c`) to get a nested value from an object. | [homepage](https://github.com/jonschlinkert/get-value)
88 * [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)
92 Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/has-value/issues/new).
96 Generate readme and API documentation with [verb](https://github.com/verbose/verb):
99 $ npm install verb && npm run docs
102 Or, if [verb](https://github.com/verbose/verb) is installed globally:
110 Install dev dependencies:
113 $ npm install -d && npm test
120 * [github/jonschlinkert](https://github.com/jonschlinkert)
121 * [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
125 Copyright © 2016, [Jon Schlinkert](https://github.com/jonschlinkert).
126 Released under the [MIT license](https://github.com/jonschlinkert/has-value/blob/master/LICENSE).
130 _This file was generated by [verb](https://github.com/verbose/verb), v, on March 27, 2016._