json-url-diff
v1.0.7
Published
JSON URL Diff ====================
Downloads
1
Readme
JSON URL Diff
Uses json-diff to get differences between two hosted JSON documents and print pretty diff to console
Usage
npm install --save json-url-diff
const urlDiff = require('json-url-diff')
Define an array of arrays for either:
- checking absolute
- checking relative urls to JSON documents
const files = {
//check absolute urls
feed:['https://jsonplaceholder.typicode.com/photos/1', 'https://jsonplaceholder.typicode.com/photos/2'],
//check relative urls (host1, host2, relative path)
feed2:['http://alpha.mysite.com', 'http://mysite.com','/feeds/90212e56-9762-490c-aa69-b399d9f09485']
}
Log diff function
urlDiff(files).then(console.log)
Prints each diff:
============= feed =============
{
- id: 2
+ id: 1
- title: "reprehenderit est deserunt velit ipsam"
+ title: "accusamus beatae ad facilis cum similique qui sunt"
- url: "https://via.placeholder.com/600/771796"
+ url: "https://via.placeholder.com/600/92c952"
- thumbnailUrl: "https://via.placeholder.com/150/771796"
+ thumbnailUrl: "https://via.placeholder.com/150/92c952"
}
============= feed2 =============
Error: Request failed with status code 404