is-type-of
Advanced tools
Comparing version 0.2.0 to 0.2.1
30
index.js
@@ -42,11 +42,16 @@ /*! | ||
exports.generator = function (obj) { | ||
return obj && 'function' === typeof obj.next && 'function' === typeof obj.throw; | ||
return obj | ||
&& 'function' === typeof obj.next | ||
&& 'function' === typeof obj.throw; | ||
}; | ||
exports.generatorFunction = function (obj) { | ||
return obj && obj.constructor && 'GeneratorFunction' === obj.constructor.name; | ||
return obj | ||
&& obj.constructor | ||
&& 'GeneratorFunction' === obj.constructor.name; | ||
}; | ||
exports.promise = function (obj) { | ||
return obj && 'function' === typeof obj.then; | ||
return obj | ||
&& 'function' === typeof obj.then; | ||
}; | ||
@@ -57,15 +62,26 @@ | ||
exports.int = function (obj) { | ||
return utils.isNumber(obj) && obj % 1 === 0; | ||
return utils.isNumber(obj) | ||
&& obj % 1 === 0; | ||
}; | ||
exports.int32 = function (obj) { | ||
return exports.int(obj) && (obj < MAX_INT_31 && obj >= -MAX_INT_31); | ||
return exports.int(obj) | ||
&& obj < MAX_INT_31 | ||
&& obj >= -MAX_INT_31; | ||
}; | ||
exports.long = function (obj) { | ||
return exports.int(obj) && (obj >= MAX_INT_31 || obj < -MAX_INT_31); | ||
if (typeof obj === 'object' && typeof obj.high === 'number' && typeof obj.low === 'number') { | ||
// support `long` module | ||
return true; | ||
} | ||
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; | ||
return utils.isNumber(obj) | ||
&& !isNaN(obj) | ||
&& obj % 1 !== 0; | ||
}; | ||
@@ -72,0 +88,0 @@ |
{ | ||
"name": "is-type-of", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "complete type checking for node", | ||
@@ -11,3 +11,3 @@ "main": "index.js", | ||
"type": "git", | ||
"url": "git://github.com/dead-horse/is-type-of.git" | ||
"url": "git://github.com/node-modules/is-type-of.git" | ||
}, | ||
@@ -24,15 +24,17 @@ "files": ["index.js"], | ||
"bugs": { | ||
"url": "https://github.com/dead-horse/is-type-of/issues" | ||
"url": "https://github.com/node-modules/is-type-of/issues" | ||
}, | ||
"homepage": "https://github.com/dead-horse/is-type-of", | ||
"homepage": "https://github.com/node-modules/is-type-of", | ||
"devDependencies": { | ||
"autod": "^0.1.1", | ||
"istanbul": "git://github.com/gotwarlost/istanbul.git#harmony", | ||
"contributors": "*", | ||
"istanbul-harmony": "*", | ||
"long": "1.1.2", | ||
"mocha": "^1.17.1", | ||
"should": "3.2.0" | ||
"should": "3.3.1" | ||
}, | ||
"dependencies": { | ||
"core-util-is": "1.0.1", | ||
"isstream": "0.1.0" | ||
"core-util-is": "^1.0.1", | ||
"isstream": "^0.1.0" | ||
} | ||
} |
@@ -92,4 +92,6 @@ is-type-of | ||
* Support [Long](https://github.com/dcodeIO/Long.js) instance. | ||
## 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
4055
77
97
6
+ Addedcore-util-is@1.0.3(transitive)
+ Addedisstream@0.1.2(transitive)
- Removedcore-util-is@1.0.1(transitive)
- Removedisstream@0.1.0(transitive)
Updatedcore-util-is@^1.0.1
Updatedisstream@^0.1.0