Permalink
Browse files

Add 'error' check

  • Loading branch information...
1 parent d927409 commit 59d872f0ffcc7d7fc403419d6ddba27846bd8d4a @cristiandouce cristiandouce 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 59d872f

Please sign in to comment.