refactor(@embark/debugger): simplify code

This commit is contained in:
Iuri Matias 2018-11-21 17:42:43 -05:00
parent 6e5fe85695
commit 7b5613a70f
2 changed files with 7 additions and 8 deletions

View File

@ -80,18 +80,17 @@ export default class DebuggerManager {
next(); next();
}); });
}, },
], () => { ]);
});
} }
// TODO: this is duplicated in debugger/index.js // TODO: this is duplicated in debugger/index.js
private simplifyDebuggerVars(data: any) { private simplifyDebuggerVars(data: any) {
const newData: any = {}; const newData: any = {};
for (const key of Object.keys(data)) { Object.keys(data).forEach((key) => {
const field = data[key]; const field = data[key];
newData[`${key} (${field.type})`] = field.value; newData[`${key} (${field.type})`] = field.value;
} });
return newData; return newData;
} }

View File

@ -137,7 +137,7 @@ class TransactionDebugger {
res.send({ok: true}); res.send({ok: true});
}); });
this.embark.registerAPICall("post", "/embark-api/debugger/StepOverBackward", (req: any, res: any) => { this.embark.registerAPICall("post", "/embark-api/debugger/StepOverBackward", (req: any, res: any) => {
if (this.apiDebugger.canGotPrevious()) { if (this.apiDebugger.canGoPrevious()) {
this.apiDebugger.stepOverBack(true); this.apiDebugger.stepOverBack(true);
} }
res.send({ok: true}); res.send({ok: true});
@ -149,7 +149,7 @@ class TransactionDebugger {
res.send({ok: true}); res.send({ok: true});
}); });
this.embark.registerAPICall("post", "/embark-api/debugger/StepIntoBackward", (req: any, res: any) => { this.embark.registerAPICall("post", "/embark-api/debugger/StepIntoBackward", (req: any, res: any) => {
if (this.apiDebugger.canGotPrevious()) { if (this.apiDebugger.canGoPrevious()) {
this.apiDebugger.stepIntoBack(true); this.apiDebugger.stepIntoBack(true);
} }
res.send({ok: true}); res.send({ok: true});
@ -181,10 +181,10 @@ class TransactionDebugger {
private simplifyDebuggerVars(data: any) { private simplifyDebuggerVars(data: any) {
const newData: any = {}; const newData: any = {};
for (const key of Object.keys(data)) { Object.keys(data).forEach((key) => {
const field = data[key]; const field = data[key];
newData[`${key} (${field.type})`] = field.value; newData[`${key} (${field.type})`] = field.value;
} });
return newData; return newData;
} }