\begin{quote}
Get the native type of a value. \end{quote}
\hypertarget{md_sfcode_node_modules_has_values_node_modules_kind_of_README_autotoc_md11511}{}\doxysection{Install}\label{md_sfcode_node_modules_has_values_node_modules_kind_of_README_autotoc_md11511}
Install with \href{https://www.npmjs.com/}{\texttt{ npm}}\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{\$ npm install -\/-\/save kind-\/of }

\end{DoxyCode}


Install with \href{https://bower.io/}{\texttt{ bower}}


\begin{DoxyCode}{0}
\DoxyCodeLine{\$ bower install kind-\/of -\/-\/save }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_has_values_node_modules_kind_of_README_autotoc_md11512}{}\doxysection{Usage}\label{md_sfcode_node_modules_has_values_node_modules_kind_of_README_autotoc_md11512}
\begin{quote}
es5, browser and es6 ready \end{quote}

\begin{DoxyCode}{0}
\DoxyCodeLine{var kindOf = require('kind-\/of');}
\DoxyCodeLine{}
\DoxyCodeLine{kindOf(undefined);}
\DoxyCodeLine{//=> 'undefined'}
\DoxyCodeLine{}
\DoxyCodeLine{kindOf(null);}
\DoxyCodeLine{//=> 'null'}
\DoxyCodeLine{}
\DoxyCodeLine{kindOf(true);}
\DoxyCodeLine{//=> 'boolean'}
\DoxyCodeLine{}
\DoxyCodeLine{kindOf(false);}
\DoxyCodeLine{//=> 'boolean'}
\DoxyCodeLine{}
\DoxyCodeLine{kindOf(new Boolean(true));}
\DoxyCodeLine{//=> 'boolean'}
\DoxyCodeLine{}
\DoxyCodeLine{kindOf(new Buffer(''));}
\DoxyCodeLine{//=> 'buffer'}
\DoxyCodeLine{}
\DoxyCodeLine{kindOf(42);}
\DoxyCodeLine{//=> 'number'}
\DoxyCodeLine{}
\DoxyCodeLine{kindOf(new Number(42));}
\DoxyCodeLine{//=> 'number'}
\DoxyCodeLine{}
\DoxyCodeLine{kindOf('str');}
\DoxyCodeLine{//=> 'string'}
\DoxyCodeLine{}
\DoxyCodeLine{kindOf(new String('str'));}
\DoxyCodeLine{//=> 'string'}
\DoxyCodeLine{}
\DoxyCodeLine{kindOf(arguments);}
\DoxyCodeLine{//=> 'arguments'}
\DoxyCodeLine{}
\DoxyCodeLine{kindOf(\{\});}
\DoxyCodeLine{//=> 'object'}
\DoxyCodeLine{}
\DoxyCodeLine{kindOf(Object.create(null));}
\DoxyCodeLine{//=> 'object'}
\DoxyCodeLine{}
\DoxyCodeLine{kindOf(new Test());}
\DoxyCodeLine{//=> 'object'}
\DoxyCodeLine{}
\DoxyCodeLine{kindOf(new Date());}
\DoxyCodeLine{//=> 'date'}
\DoxyCodeLine{}
\DoxyCodeLine{kindOf([]);}
\DoxyCodeLine{//=> 'array'}
\DoxyCodeLine{}
\DoxyCodeLine{kindOf([1, 2, 3]);}
\DoxyCodeLine{//=> 'array'}
\DoxyCodeLine{}
\DoxyCodeLine{kindOf(new Array());}
\DoxyCodeLine{//=> 'array'}
\DoxyCodeLine{}
\DoxyCodeLine{kindOf(/foo/);}
\DoxyCodeLine{//=> 'regexp'}
\DoxyCodeLine{}
\DoxyCodeLine{kindOf(new RegExp('foo'));}
\DoxyCodeLine{//=> 'regexp'}
\DoxyCodeLine{}
\DoxyCodeLine{kindOf(function () \{\});}
\DoxyCodeLine{//=> 'function'}
\DoxyCodeLine{}
\DoxyCodeLine{kindOf(function * () \{\});}
\DoxyCodeLine{//=> 'function'}
\DoxyCodeLine{}
\DoxyCodeLine{kindOf(new Function());}
\DoxyCodeLine{//=> 'function'}
\DoxyCodeLine{}
\DoxyCodeLine{kindOf(new Map());}
\DoxyCodeLine{//=> 'map'}
\DoxyCodeLine{}
\DoxyCodeLine{kindOf(new WeakMap());}
\DoxyCodeLine{//=> 'weakmap'}
\DoxyCodeLine{}
\DoxyCodeLine{kindOf(new Set());}
\DoxyCodeLine{//=> 'set'}
\DoxyCodeLine{}
\DoxyCodeLine{kindOf(new WeakSet());}
\DoxyCodeLine{//=> 'weakset'}
\DoxyCodeLine{}
\DoxyCodeLine{kindOf(Symbol('str'));}
\DoxyCodeLine{//=> 'symbol'}
\DoxyCodeLine{}
\DoxyCodeLine{kindOf(new Int8Array());}
\DoxyCodeLine{//=> 'int8array'}
\DoxyCodeLine{}
\DoxyCodeLine{kindOf(new Uint8Array());}
\DoxyCodeLine{//=> 'uint8array'}
\DoxyCodeLine{}
\DoxyCodeLine{kindOf(new Uint8ClampedArray());}
\DoxyCodeLine{//=> 'uint8clampedarray'}
\DoxyCodeLine{}
\DoxyCodeLine{kindOf(new Int16Array());}
\DoxyCodeLine{//=> 'int16array'}
\DoxyCodeLine{}
\DoxyCodeLine{kindOf(new Uint16Array());}
\DoxyCodeLine{//=> 'uint16array'}
\DoxyCodeLine{}
\DoxyCodeLine{kindOf(new Int32Array());}
\DoxyCodeLine{//=> 'int32array'}
\DoxyCodeLine{}
\DoxyCodeLine{kindOf(new Uint32Array());}
\DoxyCodeLine{//=> 'uint32array'}
\DoxyCodeLine{}
\DoxyCodeLine{kindOf(new Float32Array());}
\DoxyCodeLine{//=> 'float32array'}
\DoxyCodeLine{}
\DoxyCodeLine{kindOf(new Float64Array());}
\DoxyCodeLine{//=> 'float64array' }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_has_values_node_modules_kind_of_README_autotoc_md11513}{}\doxysection{Benchmarks}\label{md_sfcode_node_modules_has_values_node_modules_kind_of_README_autotoc_md11513}
Benchmarked against \href{http://github.com/CodingFu/typeof}{\texttt{ typeof}} and \href{https://github.com/ForbesLindesay/type-of}{\texttt{ type-\/of}}. Note that performaces is slower for es6 features {\ttfamily Map}, {\ttfamily Weak\+Map}, {\ttfamily Set} and {\ttfamily Weak\+Set}.


\begin{DoxyCode}{0}
\DoxyCodeLine{\#1: array}
\DoxyCodeLine{  current x 23,329,397 ops/sec ±0.82\% (94 runs sampled)}
\DoxyCodeLine{  lib-\/type-\/of x 4,170,273 ops/sec ±0.55\% (94 runs sampled)}
\DoxyCodeLine{  lib-\/typeof x 9,686,935 ops/sec ±0.59\% (98 runs sampled)}
\DoxyCodeLine{}
\DoxyCodeLine{\#2: boolean}
\DoxyCodeLine{  current x 27,197,115 ops/sec ±0.85\% (94 runs sampled)}
\DoxyCodeLine{  lib-\/type-\/of x 3,145,791 ops/sec ±0.73\% (97 runs sampled)}
\DoxyCodeLine{  lib-\/typeof x 9,199,562 ops/sec ±0.44\% (99 runs sampled)}
\DoxyCodeLine{}
\DoxyCodeLine{\#3: date}
\DoxyCodeLine{  current x 20,190,117 ops/sec ±0.86\% (92 runs sampled)}
\DoxyCodeLine{  lib-\/type-\/of x 5,166,970 ops/sec ±0.74\% (94 runs sampled)}
\DoxyCodeLine{  lib-\/typeof x 9,610,821 ops/sec ±0.50\% (96 runs sampled)}
\DoxyCodeLine{}
\DoxyCodeLine{\#4: function}
\DoxyCodeLine{  current x 23,855,460 ops/sec ±0.60\% (97 runs sampled)}
\DoxyCodeLine{  lib-\/type-\/of x 5,667,740 ops/sec ±0.54\% (100 runs sampled)}
\DoxyCodeLine{  lib-\/typeof x 10,010,644 ops/sec ±0.44\% (100 runs sampled)}
\DoxyCodeLine{}
\DoxyCodeLine{\#5: null}
\DoxyCodeLine{  current x 27,061,047 ops/sec ±0.97\% (96 runs sampled)}
\DoxyCodeLine{  lib-\/type-\/of x 13,965,573 ops/sec ±0.62\% (97 runs sampled)}
\DoxyCodeLine{  lib-\/typeof x 8,460,194 ops/sec ±0.61\% (97 runs sampled)}
\DoxyCodeLine{}
\DoxyCodeLine{\#6: number}
\DoxyCodeLine{  current x 25,075,682 ops/sec ±0.53\% (99 runs sampled)}
\DoxyCodeLine{  lib-\/type-\/of x 2,266,405 ops/sec ±0.41\% (98 runs sampled)}
\DoxyCodeLine{  lib-\/typeof x 9,821,481 ops/sec ±0.45\% (99 runs sampled)}
\DoxyCodeLine{}
\DoxyCodeLine{\#7: object}
\DoxyCodeLine{  current x 3,348,980 ops/sec ±0.49\% (99 runs sampled)}
\DoxyCodeLine{  lib-\/type-\/of x 3,245,138 ops/sec ±0.60\% (94 runs sampled)}
\DoxyCodeLine{  lib-\/typeof x 9,262,952 ops/sec ±0.59\% (99 runs sampled)}
\DoxyCodeLine{}
\DoxyCodeLine{\#8: regex}
\DoxyCodeLine{  current x 21,284,827 ops/sec ±0.72\% (96 runs sampled)}
\DoxyCodeLine{  lib-\/type-\/of x 4,689,241 ops/sec ±0.43\% (100 runs sampled)}
\DoxyCodeLine{  lib-\/typeof x 8,957,593 ops/sec ±0.62\% (98 runs sampled)}
\DoxyCodeLine{}
\DoxyCodeLine{\#9: string}
\DoxyCodeLine{  current x 25,379,234 ops/sec ±0.58\% (96 runs sampled)}
\DoxyCodeLine{  lib-\/type-\/of x 3,635,148 ops/sec ±0.76\% (93 runs sampled)}
\DoxyCodeLine{  lib-\/typeof x 9,494,134 ops/sec ±0.49\% (98 runs sampled)}
\DoxyCodeLine{}
\DoxyCodeLine{\#10: undef}
\DoxyCodeLine{  current x 27,459,221 ops/sec ±1.01\% (93 runs sampled)}
\DoxyCodeLine{  lib-\/type-\/of x 14,360,433 ops/sec ±0.52\% (99 runs sampled)}
\DoxyCodeLine{  lib-\/typeof x 23,202,868 ops/sec ±0.59\% (94 runs sampled)}

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_has_values_node_modules_kind_of_README_autotoc_md11514}{}\doxysection{Release history}\label{md_sfcode_node_modules_has_values_node_modules_kind_of_README_autotoc_md11514}
\hypertarget{md_sfcode_node_modules_has_values_node_modules_kind_of_README_autotoc_md11515}{}\doxysubsection{v4.\+0.\+0}\label{md_sfcode_node_modules_has_values_node_modules_kind_of_README_autotoc_md11515}
{\bfseries{Added}}


\begin{DoxyItemize}
\item {\ttfamily promise} support
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_has_values_node_modules_kind_of_README_autotoc_md11516}{}\doxysection{Optimizations}\label{md_sfcode_node_modules_has_values_node_modules_kind_of_README_autotoc_md11516}
In 7 out of 8 cases, this library is 2x-\/10x faster than other top libraries included in the benchmarks. There are a few things that lead to this performance advantage, none of them hard and fast rules, but all of them simple and repeatable in almost any code library\+:


\begin{DoxyEnumerate}
\item Optimize around the fastest and most common use cases first. Of course, this will change from project-\/to-\/project, but I took some time to understand how and why {\ttfamily typeof} checks were being used in my own libraries and other libraries I use a lot.
\item Optimize around bottlenecks -\/ In other words, the order in which conditionals are implemented is significant, because each check is only as fast as the failing checks that came before it. Here, the biggest bottleneck by far is checking for plain objects (an object that was created by the {\ttfamily Object} constructor). I opted to make this check happen by process of elimination rather than brute force up front (e.\+g. by using something like {\ttfamily val.\+constructor.\+name}), so that every other type check would not be penalized it.
\item Don\textquotesingle{}t do uneccessary processing -\/ why do {\ttfamily .slice(8, -\/1).to\+Lower\+Case();} just to get the word {\ttfamily regex}? It\textquotesingle{}s much faster to do `if (type === '\mbox{[}object Reg\+Exp\mbox{]}\textquotesingle{}) return \textquotesingle{}regex\textquotesingle{}\`{}
\end{DoxyEnumerate}\hypertarget{md_sfcode_node_modules_has_values_node_modules_kind_of_README_autotoc_md11517}{}\doxysection{About}\label{md_sfcode_node_modules_has_values_node_modules_kind_of_README_autotoc_md11517}
\hypertarget{md_sfcode_node_modules_has_values_node_modules_kind_of_README_autotoc_md11518}{}\doxysubsection{Related projects}\label{md_sfcode_node_modules_has_values_node_modules_kind_of_README_autotoc_md11518}

\begin{DoxyItemize}
\item \href{https://www.npmjs.com/package/is-glob}{\texttt{ is-\/glob}}\+: Returns {\ttfamily true} if the given string looks like a glob pattern or an extglob pattern… \href{https://github.com/jonschlinkert/is-glob}{\texttt{ more}} $\vert$ \href{https://github.com/jonschlinkert/is-glob}{\texttt{ homepage}}
\item \href{https://www.npmjs.com/package/is-number}{\texttt{ is-\/number}}\+: Returns true if the value is a number. comprehensive tests. $\vert$ \href{https://github.com/jonschlinkert/is-number}{\texttt{ homepage}}
\item \href{https://www.npmjs.com/package/is-primitive}{\texttt{ is-\/primitive}}\+: Returns {\ttfamily true} if the value is a primitive. $\vert$ \href{https://github.com/jonschlinkert/is-primitive}{\texttt{ homepage}}
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_has_values_node_modules_kind_of_README_autotoc_md11519}{}\doxysubsection{Contributing}\label{md_sfcode_node_modules_has_values_node_modules_kind_of_README_autotoc_md11519}
Pull requests and stars are always welcome. For bugs and feature requests, \href{../../issues/new}{\texttt{ please create an issue}}.\hypertarget{md_sfcode_node_modules_has_values_node_modules_kind_of_README_autotoc_md11520}{}\doxysubsection{Contributors}\label{md_sfcode_node_modules_has_values_node_modules_kind_of_README_autotoc_md11520}
\tabulinesep=1mm
\begin{longtabu}spread 0pt [c]{*{2}{|X[-1]}|}
\hline
\PBS\centering \cellcolor{\tableheadbgcolor}\textbf{ {\bfseries{Commits}}   }&\PBS\centering \cellcolor{\tableheadbgcolor}\textbf{ {\bfseries{Contributor}}    }\\\cline{1-2}
\endfirsthead
\hline
\endfoot
\hline
\PBS\centering \cellcolor{\tableheadbgcolor}\textbf{ {\bfseries{Commits}}   }&\PBS\centering \cellcolor{\tableheadbgcolor}\textbf{ {\bfseries{Contributor}}    }\\\cline{1-2}
\endhead
64   &\href{https://github.com/jonschlinkert}{\texttt{ jonschlinkert}}    \\\cline{1-2}
2   &\href{https://github.com/miguelmota}{\texttt{ miguelmota}}    \\\cline{1-2}
1   &\href{https://github.com/dtothefp}{\texttt{ dtothefp}}    \\\cline{1-2}
1   &\href{https://github.com/ksheedlo}{\texttt{ ksheedlo}}    \\\cline{1-2}
1   &\href{https://github.com/pdehaan}{\texttt{ pdehaan}}    \\\cline{1-2}
1   &\href{https://github.com/laggingreflex}{\texttt{ laggingreflex}}   \\\cline{1-2}
\end{longtabu}
\hypertarget{md_sfcode_node_modules_has_values_node_modules_kind_of_README_autotoc_md11521}{}\doxysubsection{Building docs}\label{md_sfcode_node_modules_has_values_node_modules_kind_of_README_autotoc_md11521}
\+\_\+(This project\textquotesingle{}s readme.\+md is generated by \href{https://github.com/verbose/verb-generate-readme}{\texttt{ verb}}, please don\textquotesingle{}t edit the readme directly. Any changes to the readme must be made in the .verb.md readme template.)\+\_\+

To generate the readme, run the following command\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{\$ npm install -\/g verbose/verb\#dev verb-\/generate-\/readme \&\& verb }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_has_values_node_modules_kind_of_README_autotoc_md11522}{}\doxysubsection{Running tests}\label{md_sfcode_node_modules_has_values_node_modules_kind_of_README_autotoc_md11522}
Running 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\+:


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

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_has_values_node_modules_kind_of_README_autotoc_md11523}{}\doxysubsection{Author}\label{md_sfcode_node_modules_has_values_node_modules_kind_of_README_autotoc_md11523}
{\bfseries{Jon Schlinkert}}


\begin{DoxyItemize}
\item \href{https://github.com/jonschlinkert}{\texttt{ github/jonschlinkert}}
\item \href{https://twitter.com/jonschlinkert}{\texttt{ twitter/jonschlinkert}}
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_has_values_node_modules_kind_of_README_autotoc_md11524}{}\doxysubsection{License}\label{md_sfcode_node_modules_has_values_node_modules_kind_of_README_autotoc_md11524}
Copyright © 2017, \href{https://github.com/jonschlinkert}{\texttt{ Jon Schlinkert}}. Released under the \mbox{[}MIT License\mbox{]}(LICENSE).

\DoxyHorRuler{0}


{\itshape This file was generated by \href{https://github.com/verbose/verb-generate-readme}{\texttt{ verb-\/generate-\/readme}}, v0.\+6.\+0, on May 19, 2017.} 