Skip to content

Commit

Permalink
Dev: Small Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
surunzi committed Sep 1, 2016
1 parent 3fe4623 commit 05d6f08
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eruda",
"version": "1.1.0",
"version": "1.1.1",
"description": "Console for Mobile Browsers",
"main": "eruda.js",
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions src/Console/Log.es6
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export default class Log

if (this._needSrc())
{
this.src = extractObj(args.length === 1 && util.isObj(args[0]) ? args[0] : args, {simple: false});
this.src = extractObj(args.length === 1 && util.isObj(args[0]) ? args[0] : args, {prototype: true});
}

let msg = '', icon;
Expand Down Expand Up @@ -177,7 +177,7 @@ Log.showSrcInSources = false;
function stringifyWrapper(obj, options = {})
{
util.defaults(options, {
simple: true,
prototype: false,
highlight: true,
keyQuotes: false,
specialVal: true,
Expand Down
18 changes: 9 additions & 9 deletions src/lib/stringify.es6
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import util from './util'
export default function stringify(obj, {
visited = [],
topObj,
simple = false,
prototype = false,
keyQuotes = true,
getterVal = false,
highlight = false,
Expand Down Expand Up @@ -103,15 +103,15 @@ export default function stringify(obj, {
visited.push(obj);

json = '[';
util.each(obj, val => parts.push(`${stringify(val, {visited, specialVal, simple, getterVal, keyQuotes, highlight, unenumerable})}`));
util.each(obj, val => parts.push(`${stringify(val, {visited, specialVal, prototype, getterVal, keyQuotes, highlight, unenumerable})}`));
json += parts.join(', ') + ']';
} else if (isObj || isFn)
{
visited.push(obj);

names = unenumerable ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
proto = Object.getPrototypeOf(obj);
if (proto === Object.prototype || isFn || simple) proto = null;
if (proto === Object.prototype || isFn || prototype) proto = null;
if (proto) proto = `${wrapKey('erudaProto')}: ${stringify(proto, {visited, specialVal, getterVal, topObj, keyQuotes, highlight, unenumerable})}`;
names.sort(sortObjName);
if (isFn)
Expand Down Expand Up @@ -141,10 +141,10 @@ export default function stringify(obj, {
let descriptor = Object.getOwnPropertyDescriptor(obj, name);
if (descriptor.get)
{
return parts.push(`${key}: "(...)"`);
return parts.push(`${key}: ${wrapStr('(...)')}`);
}
}
parts.push(`${key}: ${stringify(topObj[name], {visited, specialVal, getterVal, simple, keyQuotes, highlight, unenumerable})}`);
parts.push(`${key}: ${stringify(topObj[name], {visited, specialVal, getterVal, prototype, keyQuotes, highlight, unenumerable})}`);
});
if (proto) parts.push(proto);
json += parts.join(', ') + ' }';
Expand Down Expand Up @@ -183,10 +183,10 @@ export default function stringify(obj, {
visited.push(obj);

json = '{ ';
if (!simple) parts.push(`${wrapKey('erudaObjAbstract')}: "${type.replace(/(\[object )|]/g, '')}"`);
if (!prototype) parts.push(`${wrapKey('erudaObjAbstract')}: "${type.replace(/(\[object )|]/g, '')}"`);
names = unenumerable ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
proto = Object.getPrototypeOf(obj);
if (proto === Object.prototype || simple) proto = null;
if (proto === Object.prototype || prototype) proto = null;
if (proto)
{
try
Expand All @@ -207,10 +207,10 @@ export default function stringify(obj, {
let descriptor = Object.getOwnPropertyDescriptor(obj, name);
if (descriptor.get)
{
return parts.push(`${key}: "(...)"`);
return parts.push(`${key}: ${wrapStr('(...)')}`);
}
}
parts.push(`${key}: ${stringify(topObj[name], {visited, specialVal, getterVal, simple, keyQuotes, highlight, unenumerable})}`);
parts.push(`${key}: ${stringify(topObj[name], {visited, specialVal, getterVal, prototype, keyQuotes, highlight, unenumerable})}`);
});
if (proto) parts.push(proto);
json += parts.join(',\n') + ' }';
Expand Down

0 comments on commit 05d6f08

Please sign in to comment.