mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-09-02 00:43:35 +00:00
Description methods in CPArray and CPDictionary will display JavaScript object attributes instead of displaying [Object object]
Don't you hate when your logs of arrays and dictionaries display [Object object] when you have JavaScript objects in them. Now with this patch all JavaScript objects will be display with all attributes in a nice good looking way. Log CGRect, CGPoint and other JavaScript objects withour any hassle anymore. For example: console.log([myRect]);
This commit is contained in:
@@ -807,7 +807,18 @@ var concat = Array.prototype.concat,
|
||||
description += '\n';
|
||||
|
||||
var object = [self objectAtIndex:index],
|
||||
objectDescription = object && object.isa ? [object description] : String(object);
|
||||
desc = object;
|
||||
if (object && typeof(object) === "object" && !object.isa)
|
||||
{
|
||||
desc = "JSObject\n{\n";
|
||||
for (var property in object)
|
||||
{
|
||||
if (object.hasOwnProperty(property))
|
||||
desc += " " + property + ":" + object[property] + "\n";
|
||||
}
|
||||
desc += "}";
|
||||
}
|
||||
var objectDescription = object && object.isa ? [object description] : String(desc);
|
||||
|
||||
description += "\t" + objectDescription.split('\n').join("\n\t");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user