Created
December 5, 2015 20:48
-
-
Save bessarabov/aff0440f5ef3bda9afe2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var fs = require('fs'); | |
| var dataDiff = require('data-diff'); | |
| var one = fs.readFileSync('one.json'); | |
| var two = fs.readFileSync('two.json'); | |
| var diff = dataDiff(JSON.parse(one), JSON.parse(two)); | |
| console.log(diff); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
readFileSyncвозвращает буффер, а не строку.Используй лучше
require("./one.json"), он выдаёт сразу распарсенный JSON-объект.