{"name":"disparity","version":"3.1.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":"b4fd2d6a8d53eb657b2f5af8a90ad4780df35408","_id":"disparity@3.1.0","_nodeVersion":"14.2.0","_npmVersion":"6.14.4","dist":{"integrity":"sha512-HfKRKzbghP+UMUckZ4evbnc7p1TG7/Igk6nkDkSVxZtGixZY74Jcbqh4K5xHxrZsv+OjPmYTZy6dgpCQR0d3EA==","shasum":"cc2b6d708a91668b11a1876adf1407623fedfd7d","tarball":"http://registry-npm.ywwl.com/disparity/download/disparity-3.1.0.tgz","fileCount":8,"unpackedSize":15895,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJew0o4CRA9TVsSAnZWagAAiBcQAIXIQy2IPvtiEp0JaM7h\n0y/LoQskeuWR0qS6fZg/S6Bu2/JApbF+iwHrYqaSUkKdW3WqafnbiW4kWIle\nlNemKVTvlq5gqvwhcOoKn078okK43hGcU6t+dBUM9AAztBd5K1rZz9ZCr88w\nKRoUky8RpCf4VAjdCbDg44xTDdMg2CnhK/JZ/3d/RyUcKbYVcM2waYnF0OAv\nlWNmooaz8QdsbyL6J5qWOt2WYTa0Hx+RO5sj9C+Vs2+7let5kZktXIJO9CEw\nBJFTHxUMG115XvMatSz74Qh/gSbKmydD0CkMhiBHLRH7OvYqD82kKXAzAOYU\n3CuepuGrWnEITmG9H8WpAm/w3a8mwp2G5wbfqs8ju9R65Z5SrX+RUsTF7L6p\nhw0BoBUFAspfrrmOEhqs6PMVrUIF5QJzUNwhTSI3UIze18gPXp6lCQdgi/Zz\nv1ob+SWIPtHb5dfVJAy8o3AcoY/Hg3HPapz9+AIEJTDoZTUG2qmaxrBKZNTf\nd/Zw/BMAi++yIh8s6WimNgw2gaxBewMUckTHIbsbYokwyBsvinScX7JEThlc\n+vYVxkd7LbSi85wCKNiPquSb7eiT2aXtXKSJoRGnTaA/PMYHXj1EbipkyVtC\nXpzdw7WxoTnG++FEzmGKGZ0IJtQFhl9H2nI8lQ09iXWAkT12+4USCv3H7/XF\nSRQV\r\n=WX76\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBrazX4Pyqk9fapApZtjFoYGkGCARNIJbXt5ldm09cEsAiBI6ZcAY5DlJZpkZ60yg3WSlk+rFs6XnAigLTjC/ZGpNg=="}],"size":5606,"noattachment":false,"key":"/disparity/-/disparity-3.1.0.tgz"},"maintainers":[{"name":"millermedeiros","email":"miller@millermedeiros.com"}],"_npmUser":{"name":"ruyadorno","email":"ruyadorno@hotmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/disparity_3.1.0_1589856824299_0.6205033153407908"},"_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":1589856824431,"_cnpm_publish_time":1589856824431,"dist-tags":{"latest":"3.2.0"}}