andreyvit / json-diff

Structural diff for JSON files

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Need lib/colorize method to convert diffData to diffString

machao7 opened this issue · comments

thank you for your great package, it meets my needs and tastes very well except:

how can I get diffString by diffData which was saved to db ?

// server
const diffData = diff(oldData, newData);
await db.save("key", diffData);

// client
const diffString = ???(diffData);
diffDom.innerHTML = diffString;

Added colorize and colorizeToCallback to module exports in json-diff@1.0.2:

import { diffString, diff, colorize } from 'json-diff';
...
// client
const diffString = colorize(diffData);
diffDom.innerHTML = diffString;