{"_id":"disparity","_rev":"160705","name":"disparity","description":"Colorized string diff ideal for text/code that spans through multiple lines","dist-tags":{"latest":"3.2.0"},"maintainers":[{"name":"millermedeiros","email":""},{"name":"ruyadorno","email":""}],"time":{"modified":"2021-06-03T11:39:54.000Z","created":"2015-04-01T04:46:47.641Z","3.2.0":"2021-01-20T17:02:30.016Z","3.1.0":"2020-05-19T02:53:44.431Z","3.0.0":"2019-11-06T23:20:08.126Z","2.0.0":"2015-04-04T02:15:32.464Z","1.3.1":"2015-04-01T20:05:04.840Z","1.3.0":"2015-04-01T18:23:12.392Z","1.2.0":"2015-04-01T14:28:13.757Z","1.1.0":"2015-04-01T05:34:49.672Z","1.0.0":"2015-04-01T04:46:47.641Z"},"users":{"millermedeiros":true},"author":{"name":"Miller Medeiros","email":"http://millermedeiros.com"},"repository":{"type":"git","url":"git+https://github.com/millermedeiros/disparity.git"},"versions":{"3.2.0":{"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":{"shasum":"7198eaf7a873a130f8098c93061c1df8934500f2","size":5655,"noattachment":false,"key":"/disparity/-/disparity-3.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/disparity/download/disparity-3.2.0.tgz"},"_npmUser":{"name":"ruyadorno","email":"ruyadorno@hotmail.com"},"directories":{},"maintainers":[{"name":"millermedeiros","email":""},{"name":"ruyadorno","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/disparity_3.2.0_1611162149874_0.8333058564321121"},"_hasShrinkwrap":false,"publish_time":1611162150016,"_cnpm_publish_time":1611162150016},"3.1.0":{"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":{"shasum":"cc2b6d708a91668b11a1876adf1407623fedfd7d","size":5606,"noattachment":false,"key":"/disparity/-/disparity-3.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/disparity/download/disparity-3.1.0.tgz"},"maintainers":[{"name":"millermedeiros","email":""},{"name":"ruyadorno","email":""}],"_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,"publish_time":1589856824431,"_cnpm_publish_time":1589856824431},"3.0.0":{"name":"disparity","version":"3.0.0","description":"Colorized string diff ideal for text/code that spans through multiple lines","main":"disparity.js","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.1.0","diff":"^4.0.1"},"jshintConfig":{"node":true,"eqnull":true},"gitHead":"52973a5b4812bce6d7e59f7b8ea3e45893ffc50a","_id":"disparity@3.0.0","_nodeVersion":"13.1.0","_npmVersion":"6.13.0","_npmUser":{"name":"ruyadorno","email":"ruyadorno@hotmail.com"},"dist":{"shasum":"605288e8ebf38c5ccfe1e0dbc49ca6f724096500","size":5159,"noattachment":false,"key":"/disparity/-/disparity-3.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/disparity/download/disparity-3.0.0.tgz"},"maintainers":[{"name":"millermedeiros","email":""},{"name":"ruyadorno","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/disparity_3.0.0_1573082408045_0.4023005817023646"},"_hasShrinkwrap":false,"publish_time":1573082408126,"_cnpm_publish_time":1573082408126},"2.0.0":{"name":"disparity","version":"2.0.0","description":"Colorized string diff ideal for text/code that spans through multiple lines","main":"disparity.js","bin":{"disparity":"bin/disparity"},"scripts":{"test":"node test/runner.js"},"repository":{"type":"git","url":"https://github.com/millermedeiros/disparity.git"},"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":"^2.0.1","diff":"^1.3.2"},"jshintConfig":{"node":true,"eqnull":true},"gitHead":"7bd2d80e8f12790021291407a639300037c7aaf8","_id":"disparity@2.0.0","_shasum":"57ddacb47324ae5f58d2cc0da886db4ce9eeb718","_from":".","_npmVersion":"2.5.1","_nodeVersion":"0.12.0","_npmUser":{"name":"millermedeiros","email":"miller@millermedeiros.com"},"maintainers":[{"name":"millermedeiros","email":""},{"name":"ruyadorno","email":""}],"dist":{"shasum":"57ddacb47324ae5f58d2cc0da886db4ce9eeb718","size":88764,"noattachment":false,"key":"/disparity/-/disparity-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/disparity/download/disparity-2.0.0.tgz"},"directories":{},"publish_time":1428113732464,"_cnpm_publish_time":1428113732464,"_hasShrinkwrap":false},"1.3.1":{"name":"disparity","version":"1.3.1","description":"Colorized string diff ideal for text/code that spans through multiple lines","main":"disparity.js","bin":{"disparity":"bin/disparity"},"scripts":{"test":"node test/runner.js"},"repository":{"type":"git","url":"https://github.com/millermedeiros/disparity.git"},"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":"^2.0.1","diff":"^1.3.2"},"jshintConfig":{"node":true,"eqnull":true},"gitHead":"0e2e4cf737da8323551f3b1bc171ba0f700d60f6","_id":"disparity@1.3.1","_shasum":"cb56940fbe02338a38290f989d060028e9f560b1","_from":".","_npmVersion":"2.5.1","_nodeVersion":"0.12.0","_npmUser":{"name":"millermedeiros","email":"miller@millermedeiros.com"},"maintainers":[{"name":"millermedeiros","email":""},{"name":"ruyadorno","email":""}],"dist":{"shasum":"cb56940fbe02338a38290f989d060028e9f560b1","size":88238,"noattachment":false,"key":"/disparity/-/disparity-1.3.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/disparity/download/disparity-1.3.1.tgz"},"directories":{},"publish_time":1427918704840,"_cnpm_publish_time":1427918704840,"_hasShrinkwrap":false},"1.3.0":{"name":"disparity","version":"1.3.0","description":"Colorized string diff ideal for text/code that spans through multiple lines","main":"disparity.js","bin":{"disparity":"bin/disparity"},"scripts":{"test":"node test/runner.js"},"repository":{"type":"git","url":"https://github.com/millermedeiros/disparity.git"},"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":"^2.0.1","diff":"^1.3.2"},"jshintConfig":{"node":true,"eqnull":true},"gitHead":"77b555a71b91be037159e4c39b9cf23f5e8d41ab","_id":"disparity@1.3.0","_shasum":"2a30feefd64af079593f7867f52ed40c53623c16","_from":".","_npmVersion":"2.5.1","_nodeVersion":"0.12.0","_npmUser":{"name":"millermedeiros","email":"miller@millermedeiros.com"},"maintainers":[{"name":"millermedeiros","email":""},{"name":"ruyadorno","email":""}],"dist":{"shasum":"2a30feefd64af079593f7867f52ed40c53623c16","size":90178,"noattachment":false,"key":"/disparity/-/disparity-1.3.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/disparity/download/disparity-1.3.0.tgz"},"directories":{},"publish_time":1427912592392,"_cnpm_publish_time":1427912592392,"_hasShrinkwrap":false},"1.2.0":{"name":"disparity","version":"1.2.0","description":"Colorized string diff ideal for text/code that spans through multiple lines","main":"disparity.js","bin":{"disparity":"bin/disparity"},"scripts":{"test":"node test/runner.js"},"repository":{"type":"git","url":"https://github.com/millermedeiros/disparity.git"},"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":"^2.0.1","diff":"^1.3.2","has-ansi":"^1.0.3"},"jshintConfig":{"node":true,"eqnull":true},"gitHead":"b0749ded28c193e818a52408b8d25208cd3118d6","_id":"disparity@1.2.0","_shasum":"2465cf6a5e6af7c077eee64df21e9906cf68a050","_from":".","_npmVersion":"2.5.1","_nodeVersion":"0.12.0","_npmUser":{"name":"millermedeiros","email":"miller@millermedeiros.com"},"maintainers":[{"name":"millermedeiros","email":""},{"name":"ruyadorno","email":""}],"dist":{"shasum":"2465cf6a5e6af7c077eee64df21e9906cf68a050","size":89357,"noattachment":false,"key":"/disparity/-/disparity-1.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/disparity/download/disparity-1.2.0.tgz"},"directories":{},"publish_time":1427898493757,"_cnpm_publish_time":1427898493757,"_hasShrinkwrap":false},"1.1.0":{"name":"disparity","version":"1.1.0","description":"Colorized string diff ideal for text/code that spans through multiple lines","main":"disparity.js","bin":{"disparity":"bin/disparity"},"scripts":{"test":"node test/runner.js"},"repository":{"type":"git","url":"https://github.com/millermedeiros/disparity.git"},"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":"^2.0.1","diff":"^1.3.2","has-ansi":"^1.0.3"},"jshintConfig":{"node":true,"eqnull":true},"gitHead":"b05b74d9e93f053af68e14fd18df3b418e4f35ae","_id":"disparity@1.1.0","_shasum":"75c0762e47273e09fb5199a37fa02ae0d1a6bfff","_from":".","_npmVersion":"2.5.1","_nodeVersion":"0.12.0","_npmUser":{"name":"millermedeiros","email":"miller@millermedeiros.com"},"maintainers":[{"name":"millermedeiros","email":""},{"name":"ruyadorno","email":""}],"dist":{"shasum":"75c0762e47273e09fb5199a37fa02ae0d1a6bfff","size":63749,"noattachment":false,"key":"/disparity/-/disparity-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/disparity/download/disparity-1.1.0.tgz"},"directories":{},"publish_time":1427866489672,"_cnpm_publish_time":1427866489672,"_hasShrinkwrap":false},"1.0.0":{"name":"disparity","version":"1.0.0","description":"Colorized string diff ideal for text/code that spans through multiple lines","main":"disparity.js","bin":{"disparity":"bin/disparity"},"scripts":{"test":"node test/runner.js"},"repository":{"type":"git","url":"https://github.com/millermedeiros/disparity.git"},"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":"^2.0.1","diff":"^1.3.2","has-ansi":"^1.0.3"},"jshintConfig":{"node":true,"eqnull":true},"gitHead":"0b79d275c4c426121ccafbf5c331834bf48a1c22","_id":"disparity@1.0.0","_shasum":"4df48c478a827d311fec686a66aff21f3514a6a9","_from":".","_npmVersion":"2.5.1","_nodeVersion":"0.12.0","_npmUser":{"name":"millermedeiros","email":"miller@millermedeiros.com"},"maintainers":[{"name":"millermedeiros","email":""},{"name":"ruyadorno","email":""}],"dist":{"shasum":"4df48c478a827d311fec686a66aff21f3514a6a9","size":62556,"noattachment":false,"key":"/disparity/-/disparity-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/disparity/download/disparity-1.0.0.tgz"},"directories":{},"publish_time":1427863607641,"_cnpm_publish_time":1427863607641,"_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","_attachments":{},"homepage":"https://github.com/millermedeiros/disparity","bugs":{"url":"https://github.com/millermedeiros/disparity/issues"},"license":"MIT"}