Permalink
Browse files

Merge pull request #15 from cristiandouce/add-error

Add 'error' check
  • Loading branch information...
2 parents d927409 + 59d872f commit 639a20c992ed5c2a9208e2b60edd179d2e3a73c0 @Swatinem Swatinem committed Jan 9, 2014
Showing with 6 additions and 0 deletions.
  1. +1 −0 Readme.md
  2. +1 −0 index.js
  3. +4 −0 test/tests.js
View
@@ -27,6 +27,7 @@ type(/asdf/) == 'regexp'
type((function(){ return arguments })()) == 'arguments'
type([]) == 'array'
type(document.createElement('div')) == 'element'
+type(new Error('Ups! Something wrong...')) == 'error'
```
## License
View
@@ -18,6 +18,7 @@ module.exports = function(val){
case '[object RegExp]': return 'regexp';
case '[object Arguments]': return 'arguments';
case '[object Array]': return 'array';
+ case '[object Error]': return 'error';
}
if (val === null) return 'null';
View
@@ -58,4 +58,8 @@ describe('type', function(){
it('should match elements', function(){
assert('element' === type(document.createElement('div')));
});
+
+ it('should match errors', function(){
+ assert('error' === type(new Error('Ups!')));
+ });
});

0 comments on commit 639a20c

Please sign in to comment.