summaryrefslogtreecommitdiff
path: root/cli/js/console.ts
diff options
context:
space:
mode:
Diffstat (limited to 'cli/js/console.ts')
-rw-r--r--cli/js/console.ts76
1 files changed, 35 insertions, 41 deletions
diff --git a/cli/js/console.ts b/cli/js/console.ts
index e6b54d8c1..adebd729f 100644
--- a/cli/js/console.ts
+++ b/cli/js/console.ts
@@ -292,20 +292,18 @@ function createRawObjectString(
shouldShowClassName = true;
}
const keys = Object.keys(value);
- const entries: string[] = keys.map(
- (key): string => {
- if (keys.length > OBJ_ABBREVIATE_SIZE) {
- return key;
- } else {
- return `${key}: ${stringifyWithQuotes(
- value[key],
- ctx,
- level + 1,
- maxLevel
- )}`;
- }
+ const entries: string[] = keys.map((key): string => {
+ if (keys.length > OBJ_ABBREVIATE_SIZE) {
+ return key;
+ } else {
+ return `${key}: ${stringifyWithQuotes(
+ value[key],
+ ctx,
+ level + 1,
+ maxLevel
+ )}`;
}
- );
+ });
ctx.delete(value);
@@ -640,43 +638,39 @@ export class Console {
let idx = 0;
resultData = {};
- data.forEach(
- (v: unknown, k: unknown): void => {
- resultData[idx] = { Key: k, Values: v };
- idx++;
- }
- );
+ data.forEach((v: unknown, k: unknown): void => {
+ resultData[idx] = { Key: k, Values: v };
+ idx++;
+ });
} else {
resultData = data!;
}
- Object.keys(resultData).forEach(
- (k, idx): void => {
- const value: unknown = resultData[k]!;
-
- if (value !== null && typeof value === "object") {
- Object.entries(value as { [key: string]: unknown }).forEach(
- ([k, v]): void => {
- if (properties && !properties.includes(k)) {
- return;
- }
+ Object.keys(resultData).forEach((k, idx): void => {
+ const value: unknown = resultData[k]!;
- if (objectValues[k]) {
- objectValues[k].push(stringifyValue(v));
- } else {
- objectValues[k] = createColumn(v, idx);
- }
+ if (value !== null && typeof value === "object") {
+ Object.entries(value as { [key: string]: unknown }).forEach(
+ ([k, v]): void => {
+ if (properties && !properties.includes(k)) {
+ return;
}
- );
- values.push("");
- } else {
- values.push(stringifyValue(value));
- }
+ if (objectValues[k]) {
+ objectValues[k].push(stringifyValue(v));
+ } else {
+ objectValues[k] = createColumn(v, idx);
+ }
+ }
+ );
- indexKeys.push(k);
+ values.push("");
+ } else {
+ values.push(stringifyValue(value));
}
- );
+
+ indexKeys.push(k);
+ });
const headerKeys = Object.keys(objectValues);
const bodyValues = Object.values(objectValues);