Skip to content

Commit

Permalink
Add possibility to use instanceof with primitive types, by wrapping i…
Browse files Browse the repository at this point in the history
…t with Object function
  • Loading branch information
btd committed Dec 26, 2013
1 parent 3e3af97 commit 7805a50
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/should.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,14 @@ module.exports = {
(number instanceof Number).should.be.true;
number.should.be.an.instanceof(Number);

var boolean = Object(true);
(boolean instanceof Boolean).should.be.true;
boolean.should.be.an.instanceof(Boolean);

var string = Object('string');
(string instanceof String).should.be.true;
string.should.be.an.instanceof(String);

err(function(){
(3).should.an.instanceof(Foo);
}, "expected 3 to be an instance of Foo");
Expand Down

0 comments on commit 7805a50

Please sign in to comment.