UNPKG

1.32 kBMarkdownView Raw
1# kind-of [![NPM version](https://badge.fury.io/js/kind-of.svg)](http://badge.fury.io/js/kind-of)
2
3> Get the native type of a value.
4
5## Install with [npm](npmjs.org)
6
7```bash
8npm i kind-of --save
9```
10
11## Usage
12
13```js
14var kindOf = require('kind-of');
15
16kindOf(undefined);
17//=> 'undefined'
18
19kindOf(null);
20//=> 'null'
21
22kindOf(true);
23//=> 'boolean'
24
25kindOf(false);
26//=> 'boolean'
27
28kindOf(new Boolean(true));
29//=> 'boolean'
30
31kindOf(42);
32//=> 'number'
33
34kindOf(new Number(42));
35//=> 'number'
36
37kindOf("string");
38//=> 'string'
39
40kindOf(arguments);
41//=> 'arguments'
42
43kindOf({});
44//=> 'object'
45
46kindOf(new Test());
47//=> 'object'
48
49kindOf(new Date());
50//=> 'date'
51
52kindOf([]);
53//=> 'array'
54
55kindOf([1, 2, 3]);
56//=> 'array'
57
58kindOf(new Array());
59//=> 'array'
60
61kindOf(/[\s\S]+/);
62//=> 'regexp'
63
64kindOf(new RegExp('^' + 'foo$'));
65//=> 'regexp'
66
67kindOf(function () {});
68//=> 'function'
69
70kindOf(new Function());
71//=> 'function'
72```
73
74
75## Run tests
76
77Install dev dependencies:
78
79```bash
80npm i - d && mocha
81```
82
83
84## Author
85
86**Jon Schlinkert**
87
88+ [github/jonschlinkert](https://github.com/jonschlinkert)
89+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
90
91## License
92Copyright (c) 2014-2015 Jon Schlinkert
93Released under the MIT license
94
95***
96
97_This file was generated by [verb](https://github.com/assemble/verb) on February 03, 2015._
\No newline at end of file