\begin{quote}
Returns true if a value exists, false if empty. Works with deeply nested values using object paths. \end{quote}
\hypertarget{md_sfcode_node_modules_unset_value_node_modules_has_value_README_autotoc_md31506}{}\doxysection{Install}\label{md_sfcode_node_modules_unset_value_node_modules_has_value_README_autotoc_md31506}
Install with \href{https://www.npmjs.com/}{\texttt{ npm}}\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{\$ npm install has-\/value -\/-\/save }

\end{DoxyCode}


{\bfseries{Works for\+:}}


\begin{DoxyItemize}
\item booleans
\item functions
\item numbers (pass {\ttfamily true} as the last arg to treat zero as a value instead of falsey)
\item strings
\item nulls
\item object
\item arrays
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_unset_value_node_modules_has_value_README_autotoc_md31507}{}\doxysection{Usage}\label{md_sfcode_node_modules_unset_value_node_modules_has_value_README_autotoc_md31507}
Works with nested object paths or a single value\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{var hasValue = require('has-\/value');}
\DoxyCodeLine{}
\DoxyCodeLine{hasValue(\{a: \{b: \{c: 'foo'\}\}\} 'a.b.c');}
\DoxyCodeLine{//=> true}
\DoxyCodeLine{}
\DoxyCodeLine{hasValue('a');}
\DoxyCodeLine{//=> true}
\DoxyCodeLine{}
\DoxyCodeLine{hasValue('');}
\DoxyCodeLine{//=> false}
\DoxyCodeLine{}
\DoxyCodeLine{hasValue(1);}
\DoxyCodeLine{//=> true}
\DoxyCodeLine{}
\DoxyCodeLine{hasValue(0);}
\DoxyCodeLine{//=> false}
\DoxyCodeLine{}
\DoxyCodeLine{hasValue(0, true); // pass `true` as the last arg to treat zero as a value}
\DoxyCodeLine{//=> true}
\DoxyCodeLine{}
\DoxyCodeLine{hasValue(\{a: 'a'\}\});}
\DoxyCodeLine{//=> true}
\DoxyCodeLine{}
\DoxyCodeLine{hasValue(\{\}\});}
\DoxyCodeLine{//=> false}
\DoxyCodeLine{}
\DoxyCodeLine{hasValue(['a']);}
\DoxyCodeLine{//=> true}
\DoxyCodeLine{}
\DoxyCodeLine{hasValue([]);}
\DoxyCodeLine{//=> false}
\DoxyCodeLine{}
\DoxyCodeLine{hasValue(function(foo) \{\}); // function length/arity}
\DoxyCodeLine{//=> true}
\DoxyCodeLine{}
\DoxyCodeLine{hasValue(function() \{\});}
\DoxyCodeLine{//=> false}
\DoxyCodeLine{}
\DoxyCodeLine{hasValue(true);}
\DoxyCodeLine{hasValue(false);}
\DoxyCodeLine{//=> true }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_unset_value_node_modules_has_value_README_autotoc_md31508}{}\doxysection{is\+Empty}\label{md_sfcode_node_modules_unset_value_node_modules_has_value_README_autotoc_md31508}
To do the opposite and test for empty values, do\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{function isEmpty(o, isZero) \{}
\DoxyCodeLine{  return !hasValue.apply(hasValue, arguments);}
\DoxyCodeLine{\} }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_unset_value_node_modules_has_value_README_autotoc_md31509}{}\doxysection{Related projects}\label{md_sfcode_node_modules_unset_value_node_modules_has_value_README_autotoc_md31509}
You might also be interested in these projects\+:


\begin{DoxyItemize}
\item \href{https://www.npmjs.com/package/get-object}{\texttt{ get-\/object}}\+: Get a property from an object using dot (object path) notation. $\vert$ \href{https://github.com/jonschlinkert/get-object}{\texttt{ homepage}}
\item \href{https://www.npmjs.com/package/get-property}{\texttt{ get-\/property}}\+: Get a nested property or its value from an object using simple {\ttfamily a.\+b.\+c} paths. $\vert$ \href{https://github.com/jonschlinkert/get-property}{\texttt{ homepage}}
\item \href{https://www.npmjs.com/package/get-value}{\texttt{ get-\/value}}\+: Use property paths ({\ttfamily a.\+b.\+c}) to get a nested value from an object. $\vert$ \href{https://github.com/jonschlinkert/get-value}{\texttt{ homepage}}
\item \href{https://www.npmjs.com/package/set-value}{\texttt{ set-\/value}}\+: Create nested values and any intermediaries using dot notation (`\textquotesingle{}a.\+b.\+c'\`{}) paths. $\vert$ \href{https://github.com/jonschlinkert/set-value}{\texttt{ homepage}}
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_unset_value_node_modules_has_value_README_autotoc_md31510}{}\doxysection{Contributing}\label{md_sfcode_node_modules_unset_value_node_modules_has_value_README_autotoc_md31510}
Pull requests and stars are always welcome. For bugs and feature requests, \href{https://github.com/jonschlinkert/has-value/issues/new}{\texttt{ please create an issue}}.\hypertarget{md_sfcode_node_modules_unset_value_node_modules_has_value_README_autotoc_md31511}{}\doxysection{Building docs}\label{md_sfcode_node_modules_unset_value_node_modules_has_value_README_autotoc_md31511}
Generate readme and API documentation with \href{https://github.com/verbose/verb}{\texttt{ verb}}\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{\$ npm install verb \&\& npm run docs }

\end{DoxyCode}


Or, if \href{https://github.com/verbose/verb}{\texttt{ verb}} is installed globally\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{\$ verb }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_unset_value_node_modules_has_value_README_autotoc_md31512}{}\doxysection{Running tests}\label{md_sfcode_node_modules_unset_value_node_modules_has_value_README_autotoc_md31512}
Install dev dependencies\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{\$ npm install -\/d \&\& npm test }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_unset_value_node_modules_has_value_README_autotoc_md31513}{}\doxysection{Author}\label{md_sfcode_node_modules_unset_value_node_modules_has_value_README_autotoc_md31513}
{\bfseries{Jon Schlinkert}}


\begin{DoxyItemize}
\item \href{https://github.com/jonschlinkert}{\texttt{ github/jonschlinkert}}
\item \href{http://twitter.com/jonschlinkert}{\texttt{ twitter/jonschlinkert}}
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_unset_value_node_modules_has_value_README_autotoc_md31514}{}\doxysection{License}\label{md_sfcode_node_modules_unset_value_node_modules_has_value_README_autotoc_md31514}
Copyright © 2016, \href{https://github.com/jonschlinkert}{\texttt{ Jon Schlinkert}}. Released under the \href{https://github.com/jonschlinkert/has-value/blob/master/LICENSE}{\texttt{ MIT license}}.

\DoxyHorRuler{0}


{\itshape This file was generated by \href{https://github.com/verbose/verb}{\texttt{ verb}}, v, on March 27, 2016.} 