Skip to content

Commit

Permalink
fix: log diff output directly instead of converting to string (#182)
Browse files Browse the repository at this point in the history
  • Loading branch information
vdh authored and imevro committed Feb 1, 2017
1 parent 8f9f662 commit 8c916d0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/diff.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ function render(diff) {

switch (kind) {
case `E`:
return `${path.join(`.`)} ${lhs}${rhs}`;
return [path.join(`.`), lhs, `→`, rhs];
case `N`:
return `${path.join(`.`)} ${rhs}`;
return [path.join(`.`), rhs];
case `D`:
return `${path.join(`.`)}`;
return [path.join(`.`)];
case `A`:
return [`${path.join(`.`)}[${index}]`, item];
default:
return null;
return [];
}
}

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

logger.log(`%c ${dictionary[kind].text}`, style(kind), output);
logger.log(`%c ${dictionary[kind].text}`, style(kind), ...output);
});
} else {
logger.log(`—— no diff ——`);
Expand Down

0 comments on commit 8c916d0

Please sign in to comment.