Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
kenany committed Sep 15, 2013
0 parents commit cdf281c
Show file tree
Hide file tree
Showing 9 changed files with 132 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
build
components
node_modules
3 changes: 3 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# 1.0.0 / 2013-09-15

* Initial release
22 changes: 22 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Copyright 2012-2013 The Dojo Foundation <http://dojofoundation.org/>
Based on Underscore.js 1.5.2, copyright 2009-2013 Jeremy Ashkenas,
DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>

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.
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# is-nan

Lo-Dash's `isNaN` function as a component.

## Installation

``` bash
$ component install KenanY/is-nan
```

## API

``` javascript
var isNaN = require('is-nan');
```

### isNaN(value)

Checks if `value` is `NaN`.

Note that is not the same as native `isNaN` which will return `true` for
`undefined` and other non-numeric values. See <http://es5.github.io/#x15.1.2.4>.
14 changes: 14 additions & 0 deletions component.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "is-nan",
"repo": "KenanY/is-nan",
"description": "Is nan component",
"version": "1.0.0",
"keywords": [],
"dependencies": {},
"development": {},
"scripts": [
"index.js"
],
"license": "MIT",
"twitter": "@kyild"
}
20 changes: 20 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
var numberClass = '[object Number]';
var objectProto = Object.prototype;
var toString = objectProto.toString;

function isNumber(value) {
return typeof value == 'number' || toString.call(value) == numberClass;
}

/**
* Checks if `value` is `NaN`.
*
* Note: This is not the same as native `isNaN` which will return `true` for
* `undefined` and other non-numeric values. See http://es5.github.io/#x15.1.2.4.
*
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if the `value` is `NaN`, else `false`.
*/
module.exports = function(value) {
return isNumber(value) && value != +value;
}
36 changes: 36 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"name": "is-nan-component",
"version": "1.0.0",
"description": "Is NaN component",
"homepage": "https://github.com/KenanY/is-nan",
"bugs": {
"url": "https://github.com/KenanY/is-nan/issues"
},
"license": "MIT",
"author": {
"name": "Kenan Yildirim",
"email": "[email protected]",
"url": "http://kenany.me/"
},
"main": "index.js",
"directories": {
"test": "test"
},
"repository": "https://github.com/KenanY/is-nan.git",
"scripts": {
"test": "mocha -R spec --require should",
"build": "component build --dev",
"components": "component install --dev",
"clean": "rm -fr build components"
},
"devDependencies": {
"mocha": "~1.13.0",
"should": "~1.3.0"
},
"component": {
"scripts": {
"is-nan/index.js": "index.js"
}
},
"private": true
}
11 changes: 11 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
var isNaN = require('..');

describe('isNaN(value)', function() {
it('should return true for NaN', function() {
isNaN(NaN).should.be.true;
isNaN(new Number(NaN)).should.be.true;
});
it('should return false for not NaN', function() {
isNaN(undefined).should.be.false;
});
});

0 comments on commit cdf281c

Please sign in to comment.