Skip to content

Commit 8c916d0

Browse files
vdhimevro
authored andcommitted
fix: log diff output directly instead of converting to string (#182)
1 parent 8f9f662 commit 8c916d0

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/diff.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@ function render(diff) {
2929

3030
switch (kind) {
3131
case `E`:
32-
return `${path.join(`.`)} ${lhs}${rhs}`;
32+
return [path.join(`.`), lhs, `→`, rhs];
3333
case `N`:
34-
return `${path.join(`.`)} ${rhs}`;
34+
return [path.join(`.`), rhs];
3535
case `D`:
36-
return `${path.join(`.`)}`;
36+
return [path.join(`.`)];
3737
case `A`:
3838
return [`${path.join(`.`)}[${index}]`, item];
3939
default:
40-
return null;
40+
return [];
4141
}
4242
}
4343

@@ -59,7 +59,7 @@ export default function diffLogger(prevState, newState, logger, isCollapsed) {
5959
const { kind } = elem;
6060
const output = render(elem);
6161

62-
logger.log(`%c ${dictionary[kind].text}`, style(kind), output);
62+
logger.log(`%c ${dictionary[kind].text}`, style(kind), ...output);
6363
});
6464
} else {
6565
logger.log(`—— no diff ——`);

0 commit comments

Comments
 (0)