outputNewOnly = true loose colours and previous value
smartkrio opened this issue Β· comments
Hi! π
Firstly, thanks for your work on this project! π
Today I used patch-package to patch json-diff@1.0.3
for the project I'm working on.
Hello guys, I've make some changes to keep nice colourful output with previous value if outputNewOnly flag is true.
Here is the diff that solved my problem:
diff --git a/node_modules/json-diff/lib/index.js b/node_modules/json-diff/lib/index.js
index f06a825..19250bd 100644
--- a/node_modules/json-diff/lib/index.js
+++ b/node_modules/json-diff/lib/index.js
@@ -312,12 +312,7 @@ class JsonDiff {
}
if (!equal) {
score = 0
-
- if (this.options.outputNewOnly) {
- result = obj2
- } else {
- result = { __old: obj1, __new: obj2 }
- }
+ result = { __old: obj1, __new: obj2 }
} else if (!this.options.full) {
result = undefined
}
This issue body was partially generated by patch-package.