Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jonschlinkert committed Sep 26, 2014
0 parents commit 2fae09b
Show file tree
Hide file tree
Showing 11 changed files with 459 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -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
52 changes: 52 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -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
22 changes: 22 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"esnext": true,
"boss": true,
"curly": true,
"eqeqeq": true,
"eqnull": true,
"immed": true,
"latedef": true,
"newcap": true,
"noarg": true,
"node": true,
"sub": true,
"undef": true,
"unused": true,
"globals": {
"define": true,
"before": true,
"after": true,
"describe": true,
"it": true
}
}
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
language: node_js
node_js:
- '0.10'
86 changes: 86 additions & 0 deletions .verbrc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# {%= name %} {%= badge("fury") %}

> {%= description %}
## Install
{%= include("install") %}

## Run tests

```bash
npm test
```

## Usage

```js
var kindOf = require('{%= name %}');

kindOf(undefined);
//=> 'undefined'

kindOf(null);
//=> 'null'

kindOf(true);
//=> 'boolean'

kindOf(false);
//=> 'boolean'

kindOf(new Boolean(true));
//=> 'boolean'

kindOf(42);
//=> 'number'

kindOf(new Number(42));
//=> 'number'

kindOf("string");
//=> 'string'

kindOf(arguments);
//=> 'arguments'

kindOf({});
//=> 'object'

kindOf(new Test());
//=> 'object'

kindOf(new Date());
//=> 'date'

kindOf([]);
//=> 'array'

kindOf([1, 2, 3]);
//=> 'array'

kindOf(new Array());
//=> 'array'

kindOf(/[\s\S]+/);
//=> 'regexp'

kindOf(new RegExp('^' + 'foo$'));
//=> 'regexp'

kindOf(function () {});
//=> 'function'

kindOf(new Function());
//=> 'function'
```

## Author
{%= include("author") %}

## License
{%= copyright() %}
{%= license() %}

***

{%= include("footer") %}
22 changes: 22 additions & 0 deletions LICENSE-MIT
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Copyright (c) 2014 Jon Schlinkert, contributors.

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.
95 changes: 95 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# kind-of [![NPM version](https://badge.fury.io/js/kind-of.svg)](http://badge.fury.io/js/kind-of)


> Get the native type of a value.
## Install
#### Install with [npm](npmjs.org):

```bash
npm i kind-of --save-dev
```

## Run tests

```bash
npm test
```

## Usage

```js
var kindOf = require('kind-of');

kindOf(undefined);
//=> 'undefined'

kindOf(null);
//=> 'null'

kindOf(true);
//=> 'boolean'

kindOf(false);
//=> 'boolean'

kindOf(new Boolean(true));
//=> 'boolean'

kindOf(42);
//=> 'number'

kindOf(new Number(42));
//=> 'number'

kindOf("string");
//=> 'string'

kindOf(arguments);
//=> 'arguments'

kindOf({});
//=> 'object'

kindOf(new Test());
//=> 'object'

kindOf(new Date());
//=> 'date'

kindOf([]);
//=> 'array'

kindOf([1, 2, 3]);
//=> 'array'

kindOf(new Array());
//=> 'array'

kindOf(/[\s\S]+/);
//=> 'regexp'

kindOf(new RegExp('^' + 'foo$'));
//=> 'regexp'

kindOf(function () {});
//=> 'function'

kindOf(new Function());
//=> 'function'
```

## Author

**Jon Schlinkert**

+ [github/jonschlinkert](https://github.com/jonschlinkert)
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)

## License
Copyright (c) 2014 Jon Schlinkert, contributors.
Released under the MIT license

***

_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on September 26, 2014._
7 changes: 7 additions & 0 deletions bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "kind-of",
"version": "0.1.0",
"main": [
"index.js"
]
}
21 changes: 21 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
'use strict';

/**
* Get the native `typeof` a value.
*
* @param {*} `value`
* @return {*}
*/

module.exports = function kindOf(value) {
if (value === null) {
return 'null';
}

if (value === undefined) {
return 'undefined';
}

return {}.toString.call(value).toLowerCase()
.replace(/^\[object ([\S]+)\]$/, '$1');
};
Loading

0 comments on commit 2fae09b

Please sign in to comment.