Permalink
Browse files

don't need to instanciate new objects to check their constructor

  • Loading branch information...
1 parent d744c66 commit 761f6c81f1fd2162389e13484126e56fd54906c1 @JeanSebTr JeanSebTr committed Jul 16, 2012
Showing with 3 additions and 3 deletions.
  1. +3 −3 lib/helpers.js
View
@@ -38,8 +38,8 @@ exports.regExpEscape = (function() {
exports.kindof = function(o) {
if (typeof(o) != "object") return typeof(o)
if (o === null) return "null"
- if (o.constructor == (new Array).constructor) return "array"
- if (o.constructor == (new Date).constructor) return "date"
- if (o.constructor == (new RegExp).constructor) return "regex"
+ if (o.constructor == Array) return "array"
+ if (o.constructor == Date) return "date"
+ if (o.constructor == RegExp) return "regex"
return "object"
}

0 comments on commit 761f6c8

Please sign in to comment.