Navigation Menu

Skip to content

Commit

Permalink
Merge pull request #11 from maslennikov/patch-3
Browse files Browse the repository at this point in the history
Patch 3 (fixing `type` function in Chrome and Safari)
  • Loading branch information
vladocar committed Sep 17, 2011
2 parents 60655ef + 095b37b commit 7feecd1
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/o.js
Expand Up @@ -61,11 +61,17 @@
isEmpty: function (o) {
return !this.len(o);
},

type: function (o, m) {
if (!m) {
return Object.prototype.toString.call(o);
var a = (m) ? o[m] : o;
// exception for undefined and null
if ( a === null ) {
return "[object Null]";
} else if (a === undefined) {
return "[object Undefined]";
} else {
return Object.prototype.toString.call(o[m]);
// in other cases
return Object.prototype.toString.call(a);
}
},
is: function (o, t) {
Expand Down

0 comments on commit 7feecd1

Please sign in to comment.