fixed bug when Array.prototype is extended

This commit is contained in:
AJ ONeal 2011-03-06 23:46:11 -07:00
parent 85e8e0d5ac
commit 9e65aafde1
2 changed files with 4 additions and 14 deletions

View File

@ -8,9 +8,11 @@
class2type = {};
for (i in classes) {
if (classes.hasOwnProperty(i)) {
name = classes[i];
class2type["[object " + name + "]"] = name.toLowerCase();
}
}
function typeOf(obj) {
return (null === obj || undefined === obj) ? String(obj) : class2type[Object.prototype.toString.call(obj)] || "object";

View File

@ -1,12 +0,0 @@
{
"name" : "remedial",
"description" : "Douglas Crockford's Remedial JavaScript",
"url" : "http://javascript.crockford.com/remedial.html",
"keywords" : ["util", "isEmpty", "typeOf", "entityify", "quote", "supplant", "trim"],
"author" : "Douglas Crockford <douglas@crockford.com>",
"contributors" : [],
"dependencies" : [],
"lib" : "lib",
"main" : "./lib/remedial",
"version" : "1.0.4"
}