[Pkg-javascript-commits] [node-kind-of] 02/08: Import Upstream version 3.0.4

Sruthi Chandran srud-guest at moszumanska.debian.org
Sun Oct 16 10:21:12 UTC 2016


This is an automated email from the git hooks/post-receive script.

srud-guest pushed a commit to branch master
in repository node-kind-of.

commit 718ea6d3926af788789316914eba62fc362f78d1
Author: Sruthi <srud at disroot.org>
Date:   Sun Oct 16 14:35:32 2016 +0530

    Import Upstream version 3.0.4
---
 .editorconfig                          |  13 ++
 .eslintrc.json                         | 122 ++++++++++++++++
 .gitattributes                         |  14 ++
 .gitignore                             |  52 +++++++
 .travis.yml                            |  14 ++
 .verb.md                               | 138 ++++++++++++++++++
 LICENSE                                |  21 +++
 README.md                              | 247 +++++++++++++++++++++++++++++++++
 benchmark/check.js                     |  22 +++
 benchmark/code/current.js              |   1 +
 benchmark/code/lib-type-of.js          |   4 +
 benchmark/code/lib-typeof.js           |   4 +
 benchmark/code/regex-exec.js           |  18 +++
 benchmark/code/regex-replace.js        |  19 +++
 benchmark/code/slice-switch.js         |  22 +++
 benchmark/code/slice.js                |   3 +
 benchmark/fixtures/arguments.js        |   1 +
 benchmark/fixtures/array.js            |   1 +
 benchmark/fixtures/boolean.js          |   1 +
 benchmark/fixtures/buffer.js           |   1 +
 benchmark/fixtures/date.js             |   1 +
 benchmark/fixtures/function.js         |   1 +
 benchmark/fixtures/generator.js        |   1 +
 benchmark/fixtures/map.js              |   1 +
 benchmark/fixtures/null.js             |   1 +
 benchmark/fixtures/number.js           |   1 +
 benchmark/fixtures/object.js           |   1 +
 benchmark/fixtures/regex.js            |   1 +
 benchmark/fixtures/set.js              |   1 +
 benchmark/fixtures/string.js           |   1 +
 benchmark/fixtures/symbol.js           |   1 +
 benchmark/fixtures/template-strings.js |   1 +
 benchmark/fixtures/undef.js            |   1 +
 benchmark/fixtures/weakmap.js          |   1 +
 benchmark/fixtures/weakset.js          |   1 +
 benchmark/index.js                     |  11 ++
 benchmark/last.md                      |  49 +++++++
 bower.json                             |  48 +++++++
 browser.js                             | 136 ++++++++++++++++++
 index.js                               | 113 +++++++++++++++
 package.json                           |  84 +++++++++++
 test/es6/index.js                      | 101 ++++++++++++++
 test/test.js                           |  87 ++++++++++++
 43 files changed, 1362 insertions(+)

diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..818e072
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,13 @@
+root = true
+
+[*]
+indent_style = space
+end_of_line = lf
+charset = utf-8
+indent_size = 2
+trim_trailing_whitespace = true
+insert_final_newline = true
+
+[{**/{actual,fixtures,expected,templates}/**,*.md}]
+trim_trailing_whitespace = false
+insert_final_newline = false
\ No newline at end of file
diff --git a/.eslintrc.json b/.eslintrc.json
new file mode 100644
index 0000000..948dbdb
--- /dev/null
+++ b/.eslintrc.json
@@ -0,0 +1,122 @@
+{
+  "ecmaFeatures": {
+    "modules": true,
+    "experimentalObjectRestSpread": true
+  },
+
+  "env": {
+    "browser": false,
+    "es6": true,
+    "node": true,
+    "mocha": true
+  },
+
+  "globals": {
+    "document": false,
+    "navigator": false,
+    "window": false
+  },
+
+  "rules": {
+    "accessor-pairs": 2,
+    "arrow-spacing": [2, { "before": true, "after": true }],
+    "block-spacing": [2, "always"],
+    "brace-style": [2, "1tbs", { "allowSingleLine": true }],
+    "comma-dangle": [2, "never"],
+    "comma-spacing": [2, { "before": false, "after": true }],
+    "comma-style": [2, "last"],
+    "constructor-super": 2,
+    "curly": [2, "multi-line"],
+    "dot-location": [2, "property"],
+    "eol-last": 2,
+    "eqeqeq": [2, "allow-null"],
+    "generator-star-spacing": [2, { "before": true, "after": true }],
+    "handle-callback-err": [2, "^(err|error)$" ],
+    "indent": [2, 2, { "SwitchCase": 1 }],
+    "key-spacing": [2, { "beforeColon": false, "afterColon": true }],
+    "keyword-spacing": [2, { "before": true, "after": true }],
+    "new-cap": [2, { "newIsCap": true, "capIsNew": false }],
+    "new-parens": 2,
+    "no-array-constructor": 2,
+    "no-caller": 2,
+    "no-class-assign": 2,
+    "no-cond-assign": 2,
+    "no-const-assign": 2,
+    "no-control-regex": 2,
+    "no-debugger": 2,
+    "no-delete-var": 2,
+    "no-dupe-args": 2,
+    "no-dupe-class-members": 2,
+    "no-dupe-keys": 2,
+    "no-duplicate-case": 2,
+    "no-empty-character-class": 2,
+    "no-eval": 2,
+    "no-ex-assign": 2,
+    "no-extend-native": 2,
+    "no-extra-bind": 2,
+    "no-extra-boolean-cast": 2,
+    "no-extra-parens": [2, "functions"],
+    "no-fallthrough": 2,
+    "no-floating-decimal": 2,
+    "no-func-assign": 2,
+    "no-implied-eval": 2,
+    "no-inner-declarations": [2, "functions"],
+    "no-invalid-regexp": 2,
+    "no-irregular-whitespace": 2,
+    "no-iterator": 2,
+    "no-label-var": 2,
+    "no-labels": 2,
+    "no-lone-blocks": 2,
+    "no-mixed-spaces-and-tabs": 2,
+    "no-multi-spaces": 2,
+    "no-multi-str": 2,
+    "no-multiple-empty-lines": [2, { "max": 1 }],
+    "no-native-reassign": 0,
+    "no-negated-in-lhs": 2,
+    "no-new": 2,
+    "no-new-func": 2,
+    "no-new-object": 2,
+    "no-new-require": 2,
+    "no-new-wrappers": 2,
+    "no-obj-calls": 2,
+    "no-octal": 2,
+    "no-octal-escape": 2,
+    "no-proto": 0,
+    "no-redeclare": 2,
+    "no-regex-spaces": 2,
+    "no-return-assign": 2,
+    "no-self-compare": 2,
+    "no-sequences": 2,
+    "no-shadow-restricted-names": 2,
+    "no-spaced-func": 2,
+    "no-sparse-arrays": 2,
+    "no-this-before-super": 2,
+    "no-throw-literal": 2,
+    "no-trailing-spaces": 0,
+    "no-undef": 2,
+    "no-undef-init": 2,
+    "no-unexpected-multiline": 2,
+    "no-unneeded-ternary": [2, { "defaultAssignment": false }],
+    "no-unreachable": 2,
+    "no-unused-vars": [2, { "vars": "all", "args": "none" }],
+    "no-useless-call": 0,
+    "no-with": 2,
+    "one-var": [0, { "initialized": "never" }],
+    "operator-linebreak": [0, "after", { "overrides": { "?": "before", ":": "before" } }],
+    "padded-blocks": [0, "never"],
+    "quotes": [2, "single", "avoid-escape"],
+    "radix": 2,
+    "semi": [2, "always"],
+    "semi-spacing": [2, { "before": false, "after": true }],
+    "space-before-blocks": [2, "always"],
+    "space-before-function-paren": [2, "never"],
+    "space-in-parens": [2, "never"],
+    "space-infix-ops": 2,
+    "space-unary-ops": [2, { "words": true, "nonwords": false }],
+    "spaced-comment": [0, "always", { "markers": ["global", "globals", "eslint", "eslint-disable", "*package", "!", ","] }],
+    "use-isnan": 2,
+    "valid-typeof": 2,
+    "wrap-iife": [2, "any"],
+    "yoda": [2, "never"]
+  }
+}
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..759c2c5
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,14 @@
+# Enforce Unix newlines
+*.*     text eol=lf
+*.css   text eol=lf
+*.html  text eol=lf
+*.js    text eol=lf
+*.json  text eol=lf
+*.less  text eol=lf
+*.md    text eol=lf
+*.yml   text eol=lf
+
+*.jpg binary
+*.gif binary
+*.png binary
+*.jpeg binary
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..096c55d
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,52 @@
+# Numerous always-ignore extensions
+*.csv
+*.dat
+*.diff
+*.err
+*.gz
+*.log
+*.orig
+*.out
+*.pid
+*.rar
+*.rej
+*.seed
+*.swo
+*.swp
+*.vi
+*.yo-rc.json
+*.zip
+*~
+.ruby-version
+lib-cov
+npm-debug.log
+
+# Always-ignore dirs
+/bower_components/
+/node_modules/
+/temp/
+/tmp/
+/vendor/
+_gh_pages
+
+# OS or Editor folders
+*.esproj
+*.komodoproject
+.komodotools
+*.sublime-*
+._*
+.cache
+.DS_Store
+.idea
+.project
+.settings
+.tmproj
+nbproject
+Thumbs.db
+
+# grunt-html-validation
+validation-status.json
+validation-report.json
+
+# misc
+TODO.md
\ No newline at end of file
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..3932eaa
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,14 @@
+sudo: false
+language: node_js
+node_js:
+  - '6'
+  - '5'
+  - '4'
+  - '0.12'
+  - '0.10'
+matrix:
+  fast_finish: true
+  allow_failures:
+    - node_js: '4'
+    - node_js: '0.10'
+    - node_js: '0.12'
diff --git a/.verb.md b/.verb.md
new file mode 100644
index 0000000..376b40c
--- /dev/null
+++ b/.verb.md
@@ -0,0 +1,138 @@
+## Install
+
+{%= include("install-bower", {save: true}) %}
+
+## Usage
+> es5, browser and es6 ready
+
+```js
+var kindOf = require('{%= name %}');
+
+kindOf(undefined);
+//=> 'undefined'
+
+kindOf(null);
+//=> 'null'
+
+kindOf(true);
+//=> 'boolean'
+
+kindOf(false);
+//=> 'boolean'
+
+kindOf(new Boolean(true));
+//=> 'boolean'
+
+kindOf(new Buffer(''));
+//=> 'buffer'
+
+kindOf(42);
+//=> 'number'
+
+kindOf(new Number(42));
+//=> 'number'
+
+kindOf('str');
+//=> 'string'
+
+kindOf(new String('str'));
+//=> 'string'
+
+kindOf(arguments);
+//=> 'arguments'
+
+kindOf({});
+//=> 'object'
+
+kindOf(Object.create(null));
+//=> 'object'
+
+kindOf(new Test());
+//=> 'object'
+
+kindOf(new Date());
+//=> 'date'
+
+kindOf([]);
+//=> 'array'
+
+kindOf([1, 2, 3]);
+//=> 'array'
+
+kindOf(new Array());
+//=> 'array'
+
+kindOf(/foo/);
+//=> 'regexp'
+
+kindOf(new RegExp('foo'));
+//=> 'regexp'
+
+kindOf(function () {});
+//=> 'function'
+
+kindOf(function * () {});
+//=> 'function'
+
+kindOf(new Function());
+//=> 'function'
+
+kindOf(new Map());
+//=> 'map'
+
+kindOf(new WeakMap());
+//=> 'weakmap'
+
+kindOf(new Set());
+//=> 'set'
+
+kindOf(new WeakSet());
+//=> 'weakset'
+
+kindOf(Symbol('str'));
+//=> 'symbol'
+
+kindOf(new Int8Array());
+//=> 'int8array'
+
+kindOf(new Uint8Array());
+//=> 'uint8array'
+
+kindOf(new Uint8ClampedArray());
+//=> 'uint8clampedarray'
+
+kindOf(new Int16Array());
+//=> 'int16array'
+
+kindOf(new Uint16Array());
+//=> 'uint16array'
+
+kindOf(new Int32Array());
+//=> 'int32array'
+
+kindOf(new Uint32Array());
+//=> 'uint32array'
+
+kindOf(new Float32Array());
+//=> 'float32array'
+
+kindOf(new Float64Array());
+//=> 'float64array'
+```
+
+## Benchmarks
+
+Benchmarked against [typeof](http://github.com/CodingFu/typeof) and [type-of](https://github.com/ForbesLindesay/type-of).
+Note that performaces is slower for es6 features `Map`, `WeakMap`, `Set` and `WeakSet`.
+
+```bash
+{%= docs("benchmark/last.md") %}
+```
+
+## Optimizations
+
+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:
+
+1. 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 `typeof` checks were being used in my own libraries and other libraries I use a lot.
+1. 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 `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 `val.constructor.name`), so that every other type chec [...]
+1. Don't do uneccessary processing - why do `.slice(8, -1).toLowerCase();` just to get the word `regex`? It's much faster to do `if (type === '[object RegExp]') return 'regex'`
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..39245ac
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2014-2016, Jon Schlinkert.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..4ac4f18
--- /dev/null
+++ b/README.md
@@ -0,0 +1,247 @@
+# kind-of [![NPM version](https://img.shields.io/npm/v/kind-of.svg?style=flat)](https://www.npmjs.com/package/kind-of) [![NPM downloads](https://img.shields.io/npm/dm/kind-of.svg?style=flat)](https://npmjs.org/package/kind-of) [![Build Status](https://img.shields.io/travis/jonschlinkert/kind-of.svg?style=flat)](https://travis-ci.org/jonschlinkert/kind-of)
+
+Get the native type of a value.
+
+## Install
+
+Install with [npm](https://www.npmjs.com/):
+
+```sh
+$ npm install --save kind-of
+```
+
+Install with [bower](http://bower.io/)
+
+```sh
+$ bower install kind-of --save
+```
+
+## Usage
+
+> es5, browser and es6 ready
+
+```js
+var kindOf = require('kind-of');
+
+kindOf(undefined);
+//=> 'undefined'
+
+kindOf(null);
+//=> 'null'
+
+kindOf(true);
+//=> 'boolean'
+
+kindOf(false);
+//=> 'boolean'
+
+kindOf(new Boolean(true));
+//=> 'boolean'
+
+kindOf(new Buffer(''));
+//=> 'buffer'
+
+kindOf(42);
+//=> 'number'
+
+kindOf(new Number(42));
+//=> 'number'
+
+kindOf('str');
+//=> 'string'
+
+kindOf(new String('str'));
+//=> 'string'
+
+kindOf(arguments);
+//=> 'arguments'
+
+kindOf({});
+//=> 'object'
+
+kindOf(Object.create(null));
+//=> 'object'
+
+kindOf(new Test());
+//=> 'object'
+
+kindOf(new Date());
+//=> 'date'
+
+kindOf([]);
+//=> 'array'
+
+kindOf([1, 2, 3]);
+//=> 'array'
+
+kindOf(new Array());
+//=> 'array'
+
+kindOf(/foo/);
+//=> 'regexp'
+
+kindOf(new RegExp('foo'));
+//=> 'regexp'
+
+kindOf(function () {});
+//=> 'function'
+
+kindOf(function * () {});
+//=> 'function'
+
+kindOf(new Function());
+//=> 'function'
+
+kindOf(new Map());
+//=> 'map'
+
+kindOf(new WeakMap());
+//=> 'weakmap'
+
+kindOf(new Set());
+//=> 'set'
+
+kindOf(new WeakSet());
+//=> 'weakset'
+
+kindOf(Symbol('str'));
+//=> 'symbol'
+
+kindOf(new Int8Array());
+//=> 'int8array'
+
+kindOf(new Uint8Array());
+//=> 'uint8array'
+
+kindOf(new Uint8ClampedArray());
+//=> 'uint8clampedarray'
+
+kindOf(new Int16Array());
+//=> 'int16array'
+
+kindOf(new Uint16Array());
+//=> 'uint16array'
+
+kindOf(new Int32Array());
+//=> 'int32array'
+
+kindOf(new Uint32Array());
+//=> 'uint32array'
+
+kindOf(new Float32Array());
+//=> 'float32array'
+
+kindOf(new Float64Array());
+//=> 'float64array'
+```
+
+## Benchmarks
+
+Benchmarked against [typeof](http://github.com/CodingFu/typeof) and [type-of](https://github.com/ForbesLindesay/type-of).
+Note that performaces is slower for es6 features `Map`, `WeakMap`, `Set` and `WeakSet`.
+
+```bash
+#1: array
+  current x 23,329,397 ops/sec ±0.82% (94 runs sampled)
+  lib-type-of x 4,170,273 ops/sec ±0.55% (94 runs sampled)
+  lib-typeof x 9,686,935 ops/sec ±0.59% (98 runs sampled)
+
+#2: boolean
+  current x 27,197,115 ops/sec ±0.85% (94 runs sampled)
+  lib-type-of x 3,145,791 ops/sec ±0.73% (97 runs sampled)
+  lib-typeof x 9,199,562 ops/sec ±0.44% (99 runs sampled)
+
+#3: date
+  current x 20,190,117 ops/sec ±0.86% (92 runs sampled)
+  lib-type-of x 5,166,970 ops/sec ±0.74% (94 runs sampled)
+  lib-typeof x 9,610,821 ops/sec ±0.50% (96 runs sampled)
+
+#4: function
+  current x 23,855,460 ops/sec ±0.60% (97 runs sampled)
+  lib-type-of x 5,667,740 ops/sec ±0.54% (100 runs sampled)
+  lib-typeof x 10,010,644 ops/sec ±0.44% (100 runs sampled)
+
+#5: null
+  current x 27,061,047 ops/sec ±0.97% (96 runs sampled)
+  lib-type-of x 13,965,573 ops/sec ±0.62% (97 runs sampled)
+  lib-typeof x 8,460,194 ops/sec ±0.61% (97 runs sampled)
+
+#6: number
+  current x 25,075,682 ops/sec ±0.53% (99 runs sampled)
+  lib-type-of x 2,266,405 ops/sec ±0.41% (98 runs sampled)
+  lib-typeof x 9,821,481 ops/sec ±0.45% (99 runs sampled)
+
+#7: object
+  current x 3,348,980 ops/sec ±0.49% (99 runs sampled)
+  lib-type-of x 3,245,138 ops/sec ±0.60% (94 runs sampled)
+  lib-typeof x 9,262,952 ops/sec ±0.59% (99 runs sampled)
+
+#8: regex
+  current x 21,284,827 ops/sec ±0.72% (96 runs sampled)
+  lib-type-of x 4,689,241 ops/sec ±0.43% (100 runs sampled)
+  lib-typeof x 8,957,593 ops/sec ±0.62% (98 runs sampled)
+
+#9: string
+  current x 25,379,234 ops/sec ±0.58% (96 runs sampled)
+  lib-type-of x 3,635,148 ops/sec ±0.76% (93 runs sampled)
+  lib-typeof x 9,494,134 ops/sec ±0.49% (98 runs sampled)
+
+#10: undef
+  current x 27,459,221 ops/sec ±1.01% (93 runs sampled)
+  lib-type-of x 14,360,433 ops/sec ±0.52% (99 runs sampled)
+  lib-typeof x 23,202,868 ops/sec ±0.59% (94 runs sampled)
+```
+
+## Optimizations
+
+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:
+
+1. 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 `typeof` checks were being used in my own libraries and other libraries I use a lot.
+2. 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 `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 `val.constructor.name`), so that every other type chec [...]
+3. Don't do uneccessary processing - why do `.slice(8, -1).toLowerCase();` just to get the word `regex`? It's much faster to do `if (type === '[object RegExp]') return 'regex'`
+
+## About
+
+### Related projects
+
+* [is-glob](https://www.npmjs.com/package/is-glob): Returns `true` if the given string looks like a glob pattern or an extglob pattern… [more](https://github.com/jonschlinkert/is-glob) | [homepage](https://github.com/jonschlinkert/is-glob "Returns `true` if the given string looks like a glob pattern or an extglob pattern. This makes it easy to create code that only uses external modules like node-glob when necessary, resulting in much faster code execution and initialization time, and a bet")
+* [is-number](https://www.npmjs.com/package/is-number): Returns true if the value is a number. comprehensive tests. | [homepage](https://github.com/jonschlinkert/is-number "Returns true if the value is a number. comprehensive tests.")
+* [is-primitive](https://www.npmjs.com/package/is-primitive): Returns `true` if the value is a primitive.  | [homepage](https://github.com/jonschlinkert/is-primitive "Returns `true` if the value is a primitive. ")
+
+### Contributing
+
+Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
+
+### Building docs
+
+_(This document was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme) (a [verb](https://github.com/verbose/verb) generator), please don't edit the readme directly. Any changes to the readme must be made in [.verb.md](.verb.md).)_
+
+To generate the readme and API documentation with [verb](https://github.com/verbose/verb):
+
+```sh
+$ npm install -g verb verb-generate-readme && verb
+```
+
+### Running tests
+
+Install dev dependencies:
+
+```sh
+$ npm install -d && npm test
+```
+
+### Author
+
+**Jon Schlinkert**
+
+* [github/jonschlinkert](https://github.com/jonschlinkert)
+* [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
+
+### License
+
+Copyright © 2016, [Jon Schlinkert](https://github.com/jonschlinkert).
+Released under the [MIT license](https://github.com/jonschlinkert/kind-of/blob/master/LICENSE).
+
+***
+
+_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.1.28, on July 29, 2016._
\ No newline at end of file
diff --git a/benchmark/check.js b/benchmark/check.js
new file mode 100644
index 0000000..6abf3a0
--- /dev/null
+++ b/benchmark/check.js
@@ -0,0 +1,22 @@
+'use strict';
+
+var bold = require('ansi-bold');
+var path = require('path');
+var glob = require('glob');
+
+/**
+ * Sanity check
+ *
+ * Run to ensure that all fns return the same result.
+ */
+
+var fixtures = glob.sync(__dirname + '/fixtures/*.*');
+
+glob.sync(__dirname + '/code/*.js').forEach(function (fp) {
+  var fn = require(path.resolve(__dirname, 'code', fp));
+  var name = path.basename(fp, path.extname(fp));
+
+  fixtures.forEach(function (fixture) {
+    console.log(bold(name) + ':', fn.apply(null, require(fixture)));
+  });
+});
diff --git a/benchmark/code/current.js b/benchmark/code/current.js
new file mode 100644
index 0000000..24b4202
--- /dev/null
+++ b/benchmark/code/current.js
@@ -0,0 +1 @@
+module.exports = require('../..');
\ No newline at end of file
diff --git a/benchmark/code/lib-type-of.js b/benchmark/code/lib-type-of.js
new file mode 100644
index 0000000..9d1da27
--- /dev/null
+++ b/benchmark/code/lib-type-of.js
@@ -0,0 +1,4 @@
+/**
+ * https://github.com/ForbesLindesay/type-of
+ */
+module.exports = require('type-of');
\ No newline at end of file
diff --git a/benchmark/code/lib-typeof.js b/benchmark/code/lib-typeof.js
new file mode 100644
index 0000000..143625d
--- /dev/null
+++ b/benchmark/code/lib-typeof.js
@@ -0,0 +1,4 @@
+/**
+ * http://github.com/CodingFu/typeof
+ */
+module.exports = require('typeof');
\ No newline at end of file
diff --git a/benchmark/code/regex-exec.js b/benchmark/code/regex-exec.js
new file mode 100644
index 0000000..86c81eb
--- /dev/null
+++ b/benchmark/code/regex-exec.js
@@ -0,0 +1,18 @@
+var re = /^\[object (\w+)\]$/;
+
+module.exports = function typeOf(val) {
+  if (val === null) {
+    return 'null';
+  }
+
+  if (val === undefined) {
+    return 'undefined';
+  }
+
+  if (typeof val !== 'object') {
+    return typeof val;
+  }
+
+  var m = re.exec({}.toString.call(val));
+  return m[1].toLowerCase();
+};
diff --git a/benchmark/code/regex-replace.js b/benchmark/code/regex-replace.js
new file mode 100644
index 0000000..8361d25
--- /dev/null
+++ b/benchmark/code/regex-replace.js
@@ -0,0 +1,19 @@
+var re = /^\[object (\w+)\]$/;
+
+module.exports = function typeOf(val) {
+  if (val === null) {
+    return 'null';
+  }
+
+  if (val === undefined) {
+    return 'undefined';
+  }
+
+  if (typeof val !== 'object') {
+    return typeof val;
+  }
+
+  return {}.toString.call(val)
+    .toLowerCase()
+    .replace(re, '$1');
+};
diff --git a/benchmark/code/slice-switch.js b/benchmark/code/slice-switch.js
new file mode 100644
index 0000000..8121340
--- /dev/null
+++ b/benchmark/code/slice-switch.js
@@ -0,0 +1,22 @@
+module.exports = function typeOf(val) {
+  if (val === null) return 'null';
+
+  if (val === undefined) {
+    return 'undefined';
+  }
+
+  var type = typeof val;
+  switch (type) {
+    case "string":
+    case "number":
+    case "boolean":
+      return type;
+  }
+
+  if (Array.isArray(val)) {
+    return 'array';
+  }
+
+  return {}.toString.call(val)
+    .slice(8, -1).toLowerCase();
+};
diff --git a/benchmark/code/slice.js b/benchmark/code/slice.js
new file mode 100644
index 0000000..2b6f1b2
--- /dev/null
+++ b/benchmark/code/slice.js
@@ -0,0 +1,3 @@
+module.exports = function typeOf(val) {
+  return {}.toString.call(val).slice(8, -1).toLowerCase();
+};
diff --git a/benchmark/fixtures/arguments.js b/benchmark/fixtures/arguments.js
new file mode 100644
index 0000000..d863304
--- /dev/null
+++ b/benchmark/fixtures/arguments.js
@@ -0,0 +1 @@
+module.exports = [arguments];
diff --git a/benchmark/fixtures/array.js b/benchmark/fixtures/array.js
new file mode 100644
index 0000000..3fb0887
--- /dev/null
+++ b/benchmark/fixtures/array.js
@@ -0,0 +1 @@
+module.exports = [[]];
\ No newline at end of file
diff --git a/benchmark/fixtures/boolean.js b/benchmark/fixtures/boolean.js
new file mode 100644
index 0000000..5f74763
--- /dev/null
+++ b/benchmark/fixtures/boolean.js
@@ -0,0 +1 @@
+module.exports = [true];
\ No newline at end of file
diff --git a/benchmark/fixtures/buffer.js b/benchmark/fixtures/buffer.js
new file mode 100644
index 0000000..20e9408
--- /dev/null
+++ b/benchmark/fixtures/buffer.js
@@ -0,0 +1 @@
+module.exports = [new Buffer('')];
diff --git a/benchmark/fixtures/date.js b/benchmark/fixtures/date.js
new file mode 100644
index 0000000..2ebc893
--- /dev/null
+++ b/benchmark/fixtures/date.js
@@ -0,0 +1 @@
+module.exports = [new Date()];
\ No newline at end of file
diff --git a/benchmark/fixtures/function.js b/benchmark/fixtures/function.js
new file mode 100644
index 0000000..8f01d63
--- /dev/null
+++ b/benchmark/fixtures/function.js
@@ -0,0 +1 @@
+module.exports = [function () {}];
\ No newline at end of file
diff --git a/benchmark/fixtures/generator.js b/benchmark/fixtures/generator.js
new file mode 100644
index 0000000..20f763b
--- /dev/null
+++ b/benchmark/fixtures/generator.js
@@ -0,0 +1 @@
+module.exports = [function * gen() {}]
diff --git a/benchmark/fixtures/map.js b/benchmark/fixtures/map.js
new file mode 100644
index 0000000..b981b82
--- /dev/null
+++ b/benchmark/fixtures/map.js
@@ -0,0 +1 @@
+module.exports = [new Map()];
diff --git a/benchmark/fixtures/null.js b/benchmark/fixtures/null.js
new file mode 100644
index 0000000..95b1994
--- /dev/null
+++ b/benchmark/fixtures/null.js
@@ -0,0 +1 @@
+module.exports = [null];
\ No newline at end of file
diff --git a/benchmark/fixtures/number.js b/benchmark/fixtures/number.js
new file mode 100644
index 0000000..3f40c7b
--- /dev/null
+++ b/benchmark/fixtures/number.js
@@ -0,0 +1 @@
+module.exports = [42];
\ No newline at end of file
diff --git a/benchmark/fixtures/object.js b/benchmark/fixtures/object.js
new file mode 100644
index 0000000..b5cdf7c
--- /dev/null
+++ b/benchmark/fixtures/object.js
@@ -0,0 +1 @@
+module.exports = [{}];
\ No newline at end of file
diff --git a/benchmark/fixtures/regex.js b/benchmark/fixtures/regex.js
new file mode 100644
index 0000000..82751e8
--- /dev/null
+++ b/benchmark/fixtures/regex.js
@@ -0,0 +1 @@
+module.exports = [/foo/];
\ No newline at end of file
diff --git a/benchmark/fixtures/set.js b/benchmark/fixtures/set.js
new file mode 100644
index 0000000..79c2eec
--- /dev/null
+++ b/benchmark/fixtures/set.js
@@ -0,0 +1 @@
+module.exports = [new Set()];
diff --git a/benchmark/fixtures/string.js b/benchmark/fixtures/string.js
new file mode 100644
index 0000000..52fefe1
--- /dev/null
+++ b/benchmark/fixtures/string.js
@@ -0,0 +1 @@
+module.exports = ['foo bar baz'];
\ No newline at end of file
diff --git a/benchmark/fixtures/symbol.js b/benchmark/fixtures/symbol.js
new file mode 100644
index 0000000..ddf9738
--- /dev/null
+++ b/benchmark/fixtures/symbol.js
@@ -0,0 +1 @@
+module.exports = [Symbol('foo')];
diff --git a/benchmark/fixtures/template-strings.js b/benchmark/fixtures/template-strings.js
new file mode 100644
index 0000000..6bd9261
--- /dev/null
+++ b/benchmark/fixtures/template-strings.js
@@ -0,0 +1 @@
+module.exports = [`welcome buddy`];
diff --git a/benchmark/fixtures/undef.js b/benchmark/fixtures/undef.js
new file mode 100644
index 0000000..1ff92df
--- /dev/null
+++ b/benchmark/fixtures/undef.js
@@ -0,0 +1 @@
+module.exports = [undefined];
\ No newline at end of file
diff --git a/benchmark/fixtures/weakmap.js b/benchmark/fixtures/weakmap.js
new file mode 100644
index 0000000..ebd2871
--- /dev/null
+++ b/benchmark/fixtures/weakmap.js
@@ -0,0 +1 @@
+module.exports = [new WeakMap()];
diff --git a/benchmark/fixtures/weakset.js b/benchmark/fixtures/weakset.js
new file mode 100644
index 0000000..13ff2fc
--- /dev/null
+++ b/benchmark/fixtures/weakset.js
@@ -0,0 +1 @@
+module.exports = [new WeakSet()];
diff --git a/benchmark/index.js b/benchmark/index.js
new file mode 100644
index 0000000..e49c379
--- /dev/null
+++ b/benchmark/index.js
@@ -0,0 +1,11 @@
+'use strict';
+
+var Suite = require('benchmarked');
+var suite = new Suite({
+  result: false,
+  fixtures: ['fixtures/*.js', '!**/fixtures/gen*'],
+  add: 'code/{current,lib-*}.js',
+  cwd: __dirname
+});
+
+suite.run();
diff --git a/benchmark/last.md b/benchmark/last.md
new file mode 100644
index 0000000..095dd4b
--- /dev/null
+++ b/benchmark/last.md
@@ -0,0 +1,49 @@
+#1: array
+  current x 23,329,397 ops/sec ±0.82% (94 runs sampled)
+  lib-type-of x 4,170,273 ops/sec ±0.55% (94 runs sampled)
+  lib-typeof x 9,686,935 ops/sec ±0.59% (98 runs sampled)
+
+#2: boolean
+  current x 27,197,115 ops/sec ±0.85% (94 runs sampled)
+  lib-type-of x 3,145,791 ops/sec ±0.73% (97 runs sampled)
+  lib-typeof x 9,199,562 ops/sec ±0.44% (99 runs sampled)
+
+#3: date
+  current x 20,190,117 ops/sec ±0.86% (92 runs sampled)
+  lib-type-of x 5,166,970 ops/sec ±0.74% (94 runs sampled)
+  lib-typeof x 9,610,821 ops/sec ±0.50% (96 runs sampled)
+
+#4: function
+  current x 23,855,460 ops/sec ±0.60% (97 runs sampled)
+  lib-type-of x 5,667,740 ops/sec ±0.54% (100 runs sampled)
+  lib-typeof x 10,010,644 ops/sec ±0.44% (100 runs sampled)
+
+#5: null
+  current x 27,061,047 ops/sec ±0.97% (96 runs sampled)
+  lib-type-of x 13,965,573 ops/sec ±0.62% (97 runs sampled)
+  lib-typeof x 8,460,194 ops/sec ±0.61% (97 runs sampled)
+
+#6: number
+  current x 25,075,682 ops/sec ±0.53% (99 runs sampled)
+  lib-type-of x 2,266,405 ops/sec ±0.41% (98 runs sampled)
+  lib-typeof x 9,821,481 ops/sec ±0.45% (99 runs sampled)
+
+#7: object
+  current x 3,348,980 ops/sec ±0.49% (99 runs sampled)
+  lib-type-of x 3,245,138 ops/sec ±0.60% (94 runs sampled)
+  lib-typeof x 9,262,952 ops/sec ±0.59% (99 runs sampled)
+
+#8: regex
+  current x 21,284,827 ops/sec ±0.72% (96 runs sampled)
+  lib-type-of x 4,689,241 ops/sec ±0.43% (100 runs sampled)
+  lib-typeof x 8,957,593 ops/sec ±0.62% (98 runs sampled)
+
+#9: string
+  current x 25,379,234 ops/sec ±0.58% (96 runs sampled)
+  lib-type-of x 3,635,148 ops/sec ±0.76% (93 runs sampled)
+  lib-typeof x 9,494,134 ops/sec ±0.49% (98 runs sampled)
+
+#10: undef
+  current x 27,459,221 ops/sec ±1.01% (93 runs sampled)
+  lib-type-of x 14,360,433 ops/sec ±0.52% (99 runs sampled)
+  lib-typeof x 23,202,868 ops/sec ±0.59% (94 runs sampled)
diff --git a/bower.json b/bower.json
new file mode 100644
index 0000000..00e6a9a
--- /dev/null
+++ b/bower.json
@@ -0,0 +1,48 @@
+{
+  "name": "kind-of",
+  "description": "Get the native type of a value.",
+  "repository": "jonschlinkert/kind-of",
+  "license": "MIT",
+  "homepage": "https://github.com/jonschlinkert/kind-of",
+  "authors": [
+    "Jon Schlinkert (https://github.com/jonschlinkert)"
+  ],
+  "main": [
+    "index.js"
+  ],
+  "dependencies": {
+    "is-buffer": "^1.0.2"
+  },
+  "devDependencies": {
+    "benchmarked": "^0.1.3",
+    "browserify": "^11.0.1",
+    "chalk": "^0.5.1",
+    "glob": "^4.3.5",
+    "mocha": "*",
+    "should": "*",
+    "type-of": "^2.0.1",
+    "typeof": "^1.0.0"
+  },
+  "keywords": [
+    "arguments",
+    "array",
+    "boolean",
+    "check",
+    "date",
+    "function",
+    "is",
+    "is-type",
+    "is-type-of",
+    "kind",
+    "kind-of",
+    "number",
+    "object",
+    "regexp",
+    "string",
+    "test",
+    "type",
+    "type-of",
+    "typeof",
+    "types"
+  ]
+}
diff --git a/browser.js b/browser.js
new file mode 100644
index 0000000..82faf8b
--- /dev/null
+++ b/browser.js
@@ -0,0 +1,136 @@
+(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.index = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)r [...]
+var isBuffer = require('is-buffer');
+var toString = Object.prototype.toString;
+
+/**
+ * Get the native `typeof` a value.
+ *
+ * @param  {*} `val`
+ * @return {*} Native javascript type
+ */
+
+module.exports = function kindOf(val) {
+  // primitivies
+  if (typeof val === 'undefined') {
+    return 'undefined';
+  }
+  if (val === null) {
+    return 'null';
+  }
+  if (val === true || val === false || val instanceof Boolean) {
+    return 'boolean';
+  }
+  if (typeof val === 'string' || val instanceof String) {
+    return 'string';
+  }
+  if (typeof val === 'number' || val instanceof Number) {
+    return 'number';
+  }
+
+  // functions
+  if (typeof val === 'function' || val instanceof Function) {
+    return 'function';
+  }
+
+  // array
+  if (typeof Array.isArray !== 'undefined' && Array.isArray(val)) {
+    return 'array';
+  }
+
+  // check for instances of RegExp and Date before calling `toString`
+  if (val instanceof RegExp) {
+    return 'regexp';
+  }
+  if (val instanceof Date) {
+    return 'date';
+  }
+
+  // other objects
+  var type = toString.call(val);
+
+  if (type === '[object RegExp]') {
+    return 'regexp';
+  }
+  if (type === '[object Date]') {
+    return 'date';
+  }
+  if (type === '[object Arguments]') {
+    return 'arguments';
+  }
+
+  // buffer
+  if (typeof Buffer !== 'undefined' && isBuffer(val)) {
+    return 'buffer';
+  }
+
+  // es6: Map, WeakMap, Set, WeakSet
+  if (type === '[object Set]') {
+    return 'set';
+  }
+  if (type === '[object WeakSet]') {
+    return 'weakset';
+  }
+  if (type === '[object Map]') {
+    return 'map';
+  }
+  if (type === '[object WeakMap]') {
+    return 'weakmap';
+  }
+  if (type === '[object Symbol]') {
+    return 'symbol';
+  }
+
+  // typed arrays
+  if (type === '[object Int8Array]') {
+    return 'int8array';
+  }
+  if (type === '[object Uint8Array]') {
+    return 'uint8array';
+  }
+  if (type === '[object Uint8ClampedArray]') {
+    return 'uint8clampedarray';
+  }
+  if (type === '[object Int16Array]') {
+    return 'int16array';
+  }
+  if (type === '[object Uint16Array]') {
+    return 'uint16array';
+  }
+  if (type === '[object Int32Array]') {
+    return 'int32array';
+  }
+  if (type === '[object Uint32Array]') {
+    return 'uint32array';
+  }
+  if (type === '[object Float32Array]') {
+    return 'float32array';
+  }
+  if (type === '[object Float64Array]') {
+    return 'float64array';
+  }
+
+  // must be a plain object
+  return 'object';
+};
+
+},{"is-buffer":2}],2:[function(require,module,exports){
+/**
+ * Determine if an object is Buffer
+ *
+ * Author:   Feross Aboukhadijeh <feross at feross.org> <http://feross.org>
+ * License:  MIT
+ *
+ * `npm install is-buffer`
+ */
+
+module.exports = function (obj) {
+  return !!(obj != null &&
+    (obj._isBuffer || // For Safari 5-7 (missing Object.prototype.constructor)
+      (obj.constructor &&
+      typeof obj.constructor.isBuffer === 'function' &&
+      obj.constructor.isBuffer(obj))
+    ))
+}
+
+},{}]},{},[1])(1)
+});
\ No newline at end of file
diff --git a/index.js b/index.js
new file mode 100644
index 0000000..87938c9
--- /dev/null
+++ b/index.js
@@ -0,0 +1,113 @@
+var isBuffer = require('is-buffer');
+var toString = Object.prototype.toString;
+
+/**
+ * Get the native `typeof` a value.
+ *
+ * @param  {*} `val`
+ * @return {*} Native javascript type
+ */
+
+module.exports = function kindOf(val) {
+  // primitivies
+  if (typeof val === 'undefined') {
+    return 'undefined';
+  }
+  if (val === null) {
+    return 'null';
+  }
+  if (val === true || val === false || val instanceof Boolean) {
+    return 'boolean';
+  }
+  if (typeof val === 'string' || val instanceof String) {
+    return 'string';
+  }
+  if (typeof val === 'number' || val instanceof Number) {
+    return 'number';
+  }
+
+  // functions
+  if (typeof val === 'function' || val instanceof Function) {
+    return 'function';
+  }
+
+  // array
+  if (typeof Array.isArray !== 'undefined' && Array.isArray(val)) {
+    return 'array';
+  }
+
+  // check for instances of RegExp and Date before calling `toString`
+  if (val instanceof RegExp) {
+    return 'regexp';
+  }
+  if (val instanceof Date) {
+    return 'date';
+  }
+
+  // other objects
+  var type = toString.call(val);
+
+  if (type === '[object RegExp]') {
+    return 'regexp';
+  }
+  if (type === '[object Date]') {
+    return 'date';
+  }
+  if (type === '[object Arguments]') {
+    return 'arguments';
+  }
+
+  // buffer
+  if (typeof Buffer !== 'undefined' && isBuffer(val)) {
+    return 'buffer';
+  }
+
+  // es6: Map, WeakMap, Set, WeakSet
+  if (type === '[object Set]') {
+    return 'set';
+  }
+  if (type === '[object WeakSet]') {
+    return 'weakset';
+  }
+  if (type === '[object Map]') {
+    return 'map';
+  }
+  if (type === '[object WeakMap]') {
+    return 'weakmap';
+  }
+  if (type === '[object Symbol]') {
+    return 'symbol';
+  }
+
+  // typed arrays
+  if (type === '[object Int8Array]') {
+    return 'int8array';
+  }
+  if (type === '[object Uint8Array]') {
+    return 'uint8array';
+  }
+  if (type === '[object Uint8ClampedArray]') {
+    return 'uint8clampedarray';
+  }
+  if (type === '[object Int16Array]') {
+    return 'int16array';
+  }
+  if (type === '[object Uint16Array]') {
+    return 'uint16array';
+  }
+  if (type === '[object Int32Array]') {
+    return 'int32array';
+  }
+  if (type === '[object Uint32Array]') {
+    return 'uint32array';
+  }
+  if (type === '[object Float32Array]') {
+    return 'float32array';
+  }
+  if (type === '[object Float64Array]') {
+    return 'float64array';
+  }
+
+  // must be a plain object
+  return 'object';
+};
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..e649719
--- /dev/null
+++ b/package.json
@@ -0,0 +1,84 @@
+{
+  "name": "kind-of",
+  "description": "Get the native type of a value.",
+  "version": "3.0.4",
+  "homepage": "https://github.com/jonschlinkert/kind-of",
+  "author": "Jon Schlinkert (https://github.com/jonschlinkert)",
+  "repository": "jonschlinkert/kind-of",
+  "bugs": {
+    "url": "https://github.com/jonschlinkert/kind-of/issues"
+  },
+  "license": "MIT",
+  "files": [
+    "index.js",
+    "LICENSE",
+    "README.md"
+  ],
+  "main": "index.js",
+  "engines": {
+    "node": ">=0.10.0"
+  },
+  "scripts": {
+    "test": "mocha",
+    "prepublish": "browserify -o browser.js -e index.js -s index --bare"
+  },
+  "dependencies": {
+    "is-buffer": "^1.0.2"
+  },
+  "devDependencies": {
+    "ansi-bold": "^0.1.1",
+    "benchmarked": "^0.2.5",
+    "browserify": "^13.1.0",
+    "glob": "^7.0.5",
+    "gulp-format-md": "^0.1.9",
+    "mocha": "^2.5.3",
+    "type-of": "^2.0.1",
+    "typeof": "^1.0.0"
+  },
+  "keywords": [
+    "arguments",
+    "array",
+    "boolean",
+    "check",
+    "date",
+    "function",
+    "is",
+    "is-type",
+    "is-type-of",
+    "kind",
+    "kind-of",
+    "number",
+    "object",
+    "of",
+    "regexp",
+    "string",
+    "test",
+    "type",
+    "type-of",
+    "typeof",
+    "types"
+  ],
+  "verb": {
+    "related": {
+      "list": [
+        "is-glob",
+        "is-number",
+        "is-primitive"
+      ]
+    },
+    "toc": false,
+    "layout": "default",
+    "tasks": [
+      "readme"
+    ],
+    "plugins": [
+      "gulp-format-md"
+    ],
+    "lint": {
+      "reflinks": true
+    },
+    "reflinks": [
+      "verb"
+    ]
+  }
+}
diff --git a/test/es6/index.js b/test/es6/index.js
new file mode 100644
index 0000000..7fb3097
--- /dev/null
+++ b/test/es6/index.js
@@ -0,0 +1,101 @@
+'use strict';
+
+require('mocha');
+var assert = require('assert');
+var kindOf = require('../..');
+
+module.exports = function() {
+  describe('es6 features', function() {
+    it('should work for generators', function() {
+      var gen = function * named() {return true;};
+      assert.equal(kindOf(gen), 'function');
+    });
+
+    it('should work for template strings', function() {
+      var str = `Welcome buddy`;
+      assert.equal(kindOf(str), 'string');
+    });
+
+    it('should work for Map', function() {
+      var map = new Map();
+      assert.equal(kindOf(map), 'map');
+      assert.equal(kindOf(map.set), 'function');
+      assert.equal(kindOf(map.get), 'function');
+      assert.equal(kindOf(map.add), 'undefined');
+    });
+
+    it('should work for WeakMap', function() {
+      var weakmap = new WeakMap();
+      assert.equal(kindOf(weakmap), 'weakmap');
+      assert.equal(kindOf(weakmap.set), 'function');
+      assert.equal(kindOf(weakmap.get), 'function');
+      assert.equal(kindOf(weakmap.add), 'undefined');
+    });
+
+    it('should work for Set', function() {
+      var set = new Set();
+      assert.equal(kindOf(set), 'set');
+      assert.equal(kindOf(set.add), 'function');
+      assert.equal(kindOf(set.set), 'undefined');
+      assert.equal(kindOf(set.get), 'undefined');
+    });
+
+    it('should work for WeakSet', function() {
+      var weakset = new WeakSet();
+      assert.equal(kindOf(weakset), 'weakset');
+      assert.equal(kindOf(weakset.add), 'function');
+      assert.equal(kindOf(weakset.set), 'undefined');
+      assert.equal(kindOf(weakset.get), 'undefined');
+    });
+
+    it('should work for Symbol', function() {
+      assert.equal(kindOf(Symbol('foo')), 'symbol');
+      assert.equal(kindOf(Symbol.prototype), 'symbol');
+    });
+
+    it('should work for Int8Array', function() {
+      var int8array = new Int8Array();
+      assert.equal(kindOf(int8array), 'int8array');
+    });
+
+    it('should work for Uint8Array', function() {
+      var uint8array = new Uint8Array();
+      assert.equal(kindOf(uint8array), 'uint8array');
+    });
+
+    it('should work for Uint8ClampedArray', function() {
+      var uint8clampedarray = new Uint8ClampedArray();
+      assert.equal(kindOf(uint8clampedarray), 'uint8clampedarray');
+    });
+
+    it('should work for Int16Array', function() {
+      var int16array = new Int16Array();
+      assert.equal(kindOf(int16array), 'int16array');
+    });
+
+    it('should work for Uint16Array', function() {
+      var uint16array = new Uint16Array();
+      assert.equal(kindOf(uint16array), 'uint16array');
+    });
+
+    it('should work for Int32Array', function() {
+      var int32array = new Int32Array();
+      assert.equal(kindOf(int32array), 'int32array');
+    });
+
+    it('should work for Uint32Array', function() {
+      var uint32array = new Uint32Array();
+      assert.equal(kindOf(uint32array), 'uint32array');
+    });
+
+    it('should work for Float32Array', function() {
+      var float32array = new Float32Array();
+      assert.equal(kindOf(float32array), 'float32array');
+    });
+
+    it('should work for Float64Array', function() {
+      var float64array = new Float64Array();
+      assert.equal(kindOf(float64array), 'float64array');
+    });
+  });
+};
\ No newline at end of file
diff --git a/test/test.js b/test/test.js
new file mode 100644
index 0000000..418b724
--- /dev/null
+++ b/test/test.js
@@ -0,0 +1,87 @@
+'use strict';
+
+require('mocha');
+var assert = require('assert');
+var kindOf = require('..');
+
+var version = process.version.match(/^.(\d+)\.(\d+)/);
+var major = version[1];
+var minor = version[2];
+
+describe('kindOf', function() {
+  describe('null and undefined', function() {
+    it('should work for undefined', function() {
+      assert.equal(kindOf(undefined), 'undefined');
+    });
+
+    it('should work for null', function() {
+      assert.equal(kindOf(null), 'null');
+    });
+  });
+
+  describe('primitives', function() {
+    it('should work for booleans', function() {
+      assert.equal(kindOf(true), 'boolean');
+      assert.equal(kindOf(false), 'boolean');
+      assert.equal(kindOf(new Boolean(true)), 'boolean');
+    });
+
+    it('should work for numbers', function() {
+      assert.equal(kindOf(42), 'number');
+      assert.equal(kindOf(new Number(42)), 'number');
+    });
+
+    it('should work for strings', function() {
+      assert.equal(kindOf('str'), 'string');
+      assert.equal(kindOf(new String('str')), 'string');
+    });
+  });
+
+  describe('objects', function() {
+    it('should work for arguments', function() {
+      (function() {
+      assert.equal(kindOf(arguments), 'arguments');
+        return;
+      })();
+    });
+
+    it('should work for buffers', function() {
+      assert.equal(kindOf(new Buffer('')), 'buffer');
+    });
+
+    it('should work for objects', function() {
+      function Test() {}
+      var instance = new Test();
+      var literal = {};
+      var create = Object.create(null);
+
+      assert.equal(kindOf(instance), 'object');
+      assert.equal(kindOf(literal), 'object');
+      assert.equal(kindOf(create), 'object');
+    });
+
+    it('should work for dates', function() {
+      assert.equal(kindOf(new Date()), 'date');
+    });
+
+    it('should work for arrays', function() {
+      assert.equal(kindOf([]), 'array');
+      assert.equal(kindOf([1, 2, 3]), 'array');
+      assert.equal(kindOf(new Array()), 'array');
+    });
+
+    it('should work for regular expressions', function() {
+      assert.equal(kindOf(/[\s\S]+/), 'regexp');
+      assert.equal(kindOf(new RegExp('^' + 'foo$')), 'regexp');
+    });
+
+    it('should work for functions', function() {
+      assert.equal(kindOf(function() {}), 'function');
+      assert.equal(kindOf(new Function()), 'function');
+    });
+  });
+
+  if (major > 0 || minor > 11) {
+    require('./es6')();
+  }
+});

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-kind-of.git



More information about the Pkg-javascript-commits mailing list