
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Supporting Node, AMDs and the browsers ( IE 6+, Chrome 1+, Firefox 3.6+, Opera 12.1+, Safari 5.1+ )
Install node-is as dependency using npm in the command line
> npm install node-js --save
Include the module in your projects javascript file
var is = require("node-is");
Download the code from Github: is.min.js
Include it in your project
<script src="path/to/is.min.js" type="text/Javascript"></script>
is.Number(1) test for numbersis.Integer(1) test for integersis.Float(.001) test for floating point numbersis.Negative(-1.5) test for negative valuesis.Positive(1.5) test for positive valuesis.NaN(NaN) test for NaN (isNaN link)is.Finite(1) test for finite values (isFinite link)is.Infinity(Infinity) test for Infinity and -Infinityis.Boolean(false) test for boolansis.True(true) test for true booleansis.False(false) test for false booleansis.String("is") test for stringsis.EmptyString("") test for empty stringsis.Undefined(undefined) test for undefinedis.Defined({}) (!is.Undefined)is.Null(null) test for nullis.Function(function() {}) test for functionsis.Array([]) test for arraysis.EmptyArray([]) test for empty arraysis.RegExp(/^/g) test for regular expressionsis.Object({}) test for objectsis.RealObject({}) tests for real objects, null, arrays, regular expressions and errors will return falseis.Error(new Error()) test for errorsis.ReferenceError(new ReferenceError()) test for reference errorsis.TypeError(new TypeError()) test for type errorsis.SyntaxError(new SyntaxError()) test for syntax errorsis.URIError(new URIError()) test for uri errorsis.EvalError(new EvalError()) test for eval errorsis.RangeError(new RangeError()) test for range errorsis.RealError(new Error()) test for real Error-objects only, will not match RangeError, EvalError, URIError, SyntaxError, TypeError, ReferenceErroris.type.of(obj1[, obj2[, obj3[, ...]]])returns two testing functions:
equal() which can be used to test for various types that have to match all, e.g.: is.type.of(1,0).equal("Number","Integer","!Negative"); // returns trueeither() to test for various types, where at least one has to match, e.g.: is.type.of(1,0,2).either("Float","Integer"); //returns trueequal() and either() can be used to test with custom functions too:
is.type.of("hello", "world").equal("String", "!EmptyString", function(elm) { return elm[3]==="l"; }); //returns true
is.expectYou can now check types for your tests with mocha. Example:
var expect = require("node-is").expect;
describe("moche with node-is example", function() {
it("is easy and awesome", function() {
expect.type.of(1).to.be.equal("Integer", "Positive");
expect.type.of(-1).to.be.either("Positive", "Negative");
});
});
is.extend(name, fn)Parameters:
name {String} test name, the function will be registered to is.<name>fn {Function} test function, should accept one argument and return a BooleanExample:
// register
is.extend("HelloWorld", function(value) {
return is.String(value) && value === "Hello, World!";
});
// use
is.HelloWorld("Hello, World!"); // returns true
is.HelloWorld("Hello, Earth!"); // returns false
is.EmptyArray, some small improvementsis.extendis.expectis.type.of can now test an unlimited amount of arguments is.type.of(..).equal() and is.type.of(..).either() can now test custom functions tooFAQs
simplified descriptive type testing library
We found that node-is demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.