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
|
8 | npm i kind-of --save
|
9 | ```
|
10 |
|
11 | ## Usage
|
12 |
|
13 | ```js
|
14 | var kindOf = require('kind-of');
|
15 |
|
16 | kindOf(undefined);
|
17 | //=> 'undefined'
|
18 |
|
19 | kindOf(null);
|
20 | //=> 'null'
|
21 |
|
22 | kindOf(true);
|
23 | //=> 'boolean'
|
24 |
|
25 | kindOf(false);
|
26 | //=> 'boolean'
|
27 |
|
28 | kindOf(new Boolean(true));
|
29 | //=> 'boolean'
|
30 |
|
31 | kindOf(42);
|
32 | //=> 'number'
|
33 |
|
34 | kindOf(new Number(42));
|
35 | //=> 'number'
|
36 |
|
37 | kindOf("string");
|
38 | //=> 'string'
|
39 |
|
40 | kindOf(arguments);
|
41 | //=> 'arguments'
|
42 |
|
43 | kindOf({});
|
44 | //=> 'object'
|
45 |
|
46 | kindOf(new Test());
|
47 | //=> 'object'
|
48 |
|
49 | kindOf(new Date());
|
50 | //=> 'date'
|
51 |
|
52 | kindOf([]);
|
53 | //=> 'array'
|
54 |
|
55 | kindOf([1, 2, 3]);
|
56 | //=> 'array'
|
57 |
|
58 | kindOf(new Array());
|
59 | //=> 'array'
|
60 |
|
61 | kindOf(/[\s\S]+/);
|
62 | //=> 'regexp'
|
63 |
|
64 | kindOf(new RegExp('^' + 'foo$'));
|
65 | //=> 'regexp'
|
66 |
|
67 | kindOf(function () {});
|
68 | //=> 'function'
|
69 |
|
70 | kindOf(new Function());
|
71 | //=> 'function'
|
72 | ```
|
73 |
|
74 |
|
75 | ## Run tests
|
76 |
|
77 | Install dev dependencies:
|
78 |
|
79 | ```bash
|
80 | npm 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
|
92 | Copyright (c) 2014-2015 Jon Schlinkert
|
93 | Released 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 |