1
0
mirror of synced 2025-11-06 04:21:11 +08:00

Dev: Small Changes

This commit is contained in:
surunzi
2016-09-02 00:58:28 +08:00
parent 3fe4623544
commit 05d6f08e4e
3 changed files with 12 additions and 12 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "eruda",
"version": "1.1.0",
"version": "1.1.1",
"description": "Console for Mobile Browsers",
"main": "eruda.js",
"scripts": {

View File

@@ -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;
@@ -177,7 +177,7 @@ Log.showSrcInSources = false;
function stringifyWrapper(obj, options = {})
{
util.defaults(options, {
simple: true,
prototype: false,
highlight: true,
keyQuotes: false,
specialVal: true,

View File

@@ -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,
@@ -103,7 +103,7 @@ 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)
{
@@ -111,7 +111,7 @@ export default function stringify(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)
@@ -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(', ') + ' }';
@@ -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
@@ -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') + ' }';