is-type-of
Advanced tools
Comparing version 0.0.0 to 0.0.1
15
index.js
@@ -36,1 +36,16 @@ /*! | ||
}; | ||
var MAX_INT_31 = Math.pow(2, 31); | ||
exports.int = function (obj) { | ||
return utils.isNumber(obj) && obj % 1 === 0; | ||
}; | ||
exports.long = function (obj) { | ||
return exports.int(obj) && (obj >= MAX_INT_31 || obj < -MAX_INT_31); | ||
}; | ||
exports.double = function (obj) { | ||
return utils.isNumber(obj) && !isNaN(obj) && obj % 1 !== 0; | ||
}; | ||
{ | ||
"name": "is-type-of", | ||
"version": "0.0.0", | ||
"version": "0.0.1", | ||
"description": "complete type checking for node", | ||
@@ -27,3 +27,7 @@ "main": "index.js", | ||
"devDependencies": { | ||
"autod": "^0.1.1" | ||
"autod": "^0.1.1", | ||
"co-wait": "0.0.0", | ||
"istanbul": "git://github.com/gotwarlost/istanbul.git#harmony", | ||
"should": "^3.1.3", | ||
"mocha": "^1.17.1" | ||
}, | ||
@@ -30,0 +34,0 @@ "dependencies": { |
is-type-of | ||
========== | ||
complete type checking for node | ||
complete type checking for node, extend [core-util-is](https://github.com/isaacs/core-util-is) | ||
## Install | ||
``` | ||
npm install is-type-of | ||
``` | ||
## Example | ||
``` | ||
var is = require('is-type-of'); | ||
is.array([1]); // => true | ||
is.primitive(true); // => true | ||
is.primitive({}); // => false | ||
is.generatorFunction(function * () {}); // => true | ||
is.long(Math.pow(2, 33)); // => true | ||
is.double(0); // => false | ||
``` | ||
## API | ||
### From [core-util-is](https://github.com/isaacs/core-util-is) | ||
#### is.array(arr) | ||
#### is.boolean(bool) | ||
#### is.null(null) | ||
#### is.nullOrUndefined(null) | ||
#### is.number(num) | ||
#### is.string(str) | ||
#### is.symbol(sym) | ||
#### is.undefined(undef) | ||
#### is.regExp(reg) | ||
#### is.object(obj) | ||
#### is.date(date) | ||
#### is.error(err) | ||
#### is.function(fn) | ||
#### is.primitive(prim) | ||
#### is.buffer(buf) | ||
### Extend API | ||
#### is.generator(gen) | ||
#### is.generatorFunction(fn) | ||
#### is.promise(fn) | ||
#### is.int(int) | ||
#### is.double(double) | ||
#### is.long(long) | ||
## License | ||
MIT |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2844
37
76
5