Object description formatting

- Made CPDescriptionOfObject smarter about detecting CG objects
- CPObject, CPArray, CPDictionary do a better (as in perfect) job of indenting nested objects
- CPDictionary is displayed using Cocoa-style key = value; notation
This commit is contained in:
Aparajita Fishman
2013-01-25 19:19:01 +08:00
parent 2d34d458f4
commit 95790d55d5
6 changed files with 60 additions and 59 deletions
+7 -5
View File
@@ -874,18 +874,20 @@ var concat = Array.prototype.concat,
{
var index = 0,
count = [self count],
description = "@[";
description = "[";
for (; index < count; ++index)
{
if (index === 0)
description += "\n\t";
description += "\n";
var object = [self objectAtIndex:index];
description += CPDescriptionOfObject(object);
if (index !== count - 1)
description += ",\n\t";
// NOTE: replace(/^/mg, " ") inserts 4 spaces at the beginning of every line
description += CPDescriptionOfObject(object).replace(/^/mg, " ");
if (index < count - 1)
description += ",\n";
else
description += "\n";
}