Skip to content

Commit

Permalink
isNaN
Browse files Browse the repository at this point in the history
  • Loading branch information
msfidelis committed Nov 7, 2017
1 parent a0c3bd7 commit 15a6bde
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/raj.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ module.exports = {
isObject: validations.isObject,
isNumber: validations.isNumber,
isArray: validations.isArray,
isNaN: validations.isNaN,

//Objects
selectFromObject: objectHelpers.selectFromObject,
Expand Down
3 changes: 2 additions & 1 deletion lib/src/validations.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ module.exports = {
isString: (object) => typeof object === 'string' || object instanceof String,
isObject: (object) => typeof object === 'object' || object instanceof Object,
isNumber: (object) => typeof object === 'number' || object instanceof Number,
isArray: (object) => object instanceof Array
isArray: (object) => object instanceof Array,
isNaN: (object) => isNaN(object)
};
11 changes: 11 additions & 0 deletions test/validations.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,15 @@ describe("#Validations Test", () => {
expect(raj.isArray(number)).to.be.false;
expect(raj.isArray(array)).to.be.true;
});



it("#raj.isNaN()", () => {

expect(raj.isNaN(123)).to.be.false;
expect(raj.isNaN(-1.23)).to.be.false;
expect(raj.isNaN(5-2)).to.be.false;
expect(raj.isNaN('modafoca')).to.be.true;

});
});

0 comments on commit 15a6bde

Please sign in to comment.