{"name":"disparity","version":"3.2.0","description":"Colorized string diff ideal for text/code that spans through multiple lines","main":"disparity.js","types":"disparity.d.ts","bin":{"disparity":"bin/disparity"},"scripts":{"test":"node test/runner.js"},"repository":{"type":"git","url":"git+https://github.com/millermedeiros/disparity.git"},"engines":{"node":">=8"},"keywords":["diff","char","unified","multiline","string","color","ansi","terminal","cli","tty"],"author":{"name":"Miller Medeiros","email":"http://millermedeiros.com"},"license":"MIT","bugs":{"url":"https://github.com/millermedeiros/disparity/issues"},"homepage":"https://github.com/millermedeiros/disparity","dependencies":{"ansi-styles":"^4.2.1","diff":"^4.0.2"},"jshintConfig":{"node":true,"eqnull":true},"devDependencies":{},"gitHead":"247e7d09f9a4fb3f1394fb1135696f243d7bfced","_id":"disparity@3.2.0","_nodeVersion":"14.15.4","_npmVersion":"7.4.2","dist":{"integrity":"sha512-8cl9ouncFYE7OQsYwJNiy2e15S0xN80X1Jj/N/YkoiM+VGWSyg1YzPToecKyYx2DQiJapt5IC8yi43GW23TUHQ==","shasum":"7198eaf7a873a130f8098c93061c1df8934500f2","tarball":"http://registry-npm.ywwl.com/disparity/download/disparity-3.2.0.tgz","fileCount":8,"unpackedSize":16035,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgCGImCRA9TVsSAnZWagAAzAsP/1msDFf+qoVxD6ydaLJt\n7H/WxK3xbt64xOuFnD0OhtmXv24DoQgHfW+dzZb8pFFAkOdzvw4JvZz36rc+\nxxe4YlwsKwL4iTtLrXWdSJyQ1ihfrrf7OtcWjguvow1CPgqDCRyPHh0yLup4\ntjDnVUyjQISY6J3j0baEysLYWk0oIb1u8Pqawzw91W/Tw7Gh39IWrTJp0sHU\ny1Vd+mHWHDwE/NsjZl3esSs2OPyUVsBW/+4YrqOb8g5eWasRPrFq7cyA7H2f\nlcp/x1K/KFNyBzCyxuWS3VwWI2eKJ1q7Pv7lxMSD+Ktj0njLOQvscLxkkAo0\n/Xp95O1o4HQZLxlGwHQpm7hXmayV9dGJ1Qoyh10UYVrEnKCUCaXs3YjRrgRV\neYQVma7JXJiN0V1ThRfRJ78UPKcbe9OprXlyN+zytuq7gbEzzDq+b+wBC20R\nn25oqgnG8sWrQkn2dr65qojaHX2utPUTub7Gm0FRjx7mRnMYO0Xwkcyp71zd\nn4TA17/DPVC4QiVn+WeqWzK2w0qI9dx4ZRUgu66pKAB/3Wufsgy177f6oRyo\n6StfiKAQ5mt40XeCN/1CH4S7nzIr5olkUL2h8kpssvX2HqhS9S+xEx9LIrb6\nJbKkGVWQZHYh6wUsICp8U4uI3aoW67yVrFUILhfMId73Q1IRh1RoOzzswFmz\nvR8/\r\n=gI0A\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEzf9knomS5iG1kP/6qLTqiM4befueVVvbngth8Kd+b1AiBmdXbkku6AMFgVdP/79Wtczz2vACTXzHRYVczSkzt9KQ=="}],"size":5655,"noattachment":false,"key":"/disparity/-/disparity-3.2.0.tgz"},"_npmUser":{"name":"ruyadorno","email":"ruyadorno@hotmail.com"},"directories":{},"maintainers":[{"name":"ruyadorno","email":"ruyadorno@hotmail.com"},{"name":"millermedeiros","email":"miller@millermedeiros.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/disparity_3.2.0_1611162149874_0.8333058564321121"},"_hasShrinkwrap":false,"readme":"# disparity\n\nColorized string diff ideal for text/code that spans through multiple lines.\n\nThis is basically just a wrapper around\n[diff](https://www.npmjs.com/package/diff) and\n[ansi-styles](https://www.npmjs.com/package/ansi-styles) + line numbers and\nomitting lines that don't have changes and/or that wouldn't help user identify\nthe diff \"context\".\n\nWe also replace some *invisible* chars to make it easier to understand what\nreally changed from one file to another:\n\n - `\\r` becomes `<CR>`\n - `\\n` becomes `<LF>`\n - `\\t` becomes `<tab>`\n\nCreated mainly to be used by\n[esformatter](https://www.npmjs.com/package/esformatter) and other tools that\nmight need to display a nice looking diff of source files.\n\n\n## API\n\n```js\nvar disparity = require('disparity');\n```\n\n### chars(oldStr, newStr[, opts]):String\n\nDiffs two blocks of text, comparing character by character and returns\na `String` with ansi color codes.\n\n```js\nvar diff = disparity.chars(file1, file2);\nconsole.log(diff);\n```\n\nWill return an empty string if `oldStr === newStr`;\n\n```js\n// default options\nvar opts = {\n  // how many lines to display before/after a line that contains diffs\n  context: 3,\n  // file paths displayed just before the diff\n  paths: [disparity.removed, disparity.added]\n};\n```\n\n![screenshot char diff](https://raw.githubusercontent.com/millermedeiros/disparity/master/screenshots/chars.png)\n\n### unified(oldStr, newStr[, opts]):String\n\nReturns ansi colorized [unified\ndiff](http://en.wikipedia.org/wiki/Diff_utility#Unified_format).\n\nWill return an empty string if `oldStr === newStr`;\n\n```js\nvar diff = disparity.unified(file1, file2, {\n  paths: ['test/file1.js', 'test/file2.js']\n});\nconsole.log(diff);\n```\n\n![screenshot unified diff](https://raw.githubusercontent.com/millermedeiros/disparity/master/screenshots/unified.png)\n\n### unifiedNoColor(oldStr, newStr[, opts]):String\n\nReturns [unified diff](http://en.wikipedia.org/wiki/Diff_utility#Unified_format).\nUseful for terminals that [doesn't support colors](https://www.npmjs.com/package/supports-color).\n\nWill return an empty string if `oldStr === newStr`;\n\n```js\nvar diff = disparity.unifiedNoColor(file1, file2, {\n  paths: ['test/file1.js', 'test/file2.js']\n});\nconsole.log(diff);\n```\n\n![screenshot unified diff no color](https://raw.githubusercontent.com/millermedeiros/disparity/master/screenshots/unified_no_color.png)\n\n### removed:String\n\nString used on the diff headers to say that chars/lines was removed.\n\n```js\n// default value\ndisparity.removed = 'removed';\n```\n\n### added:String\n\nString used on the diff headers to say that chars/lines was added.\n\n```js\n// default value\ndisparity.added = 'added';\n```\n\n### colors:Object\n\nObject containing references to all the colors used by disparity.\n\nIf you want a different output than `ansi` (eg. HTML) you can replace the color\nvalues:\n\n```js\n// wrap blocks into custom tags\ndisparity.colors = {\n  // chars diff\n  charsRemoved: { open: '<bggreen>', close: '</bggreen>' },\n  charsAdded: { open: '<bgred>', close: '</bgred>' },\n\n  // unified diff\n  removed: { open: '<red>', close: '</red>' },\n  added: { open: '<green>', close: '</green>' },\n  header: { open: '<yellow>', close: '</yellow>' },\n  section: { open: '<magenta>', close: '</magenta>' }\n};\n```\n\n## CLI\n\n`disparity` also have a command line interface:\n\n```\ndisparity [OPTIONS] <file_1> <file_2>\n\nOptions:\n  -c, --chars           Output char diff (default mode).\n  -u, --unified         Output unified diff.\n  --unified-no-color    Don't output colors.\n  -v, --version         Display current version.\n  -h, --help            Display this help.\n```\n\nPS: cli can only compare 2 external files at the moment, no `stdin` support.\n\n## License\n\nReleased under the MIT license.\n\n","publish_time":1611162150016,"_cnpm_publish_time":1611162150016,"dist-tags":{"latest":"3.2.0"}}