{"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":"miller@millermedeiros.com"}],"dist":{"shasum":"57ddacb47324ae5f58d2cc0da886db4ce9eeb718","tarball":"http://registry-npm.ywwl.com/disparity/download/disparity-2.0.0.tgz","integrity":"sha512-caMA9oIQbDeobWc9MVUF0+o1APVo0UZnfD482x0RaLLAzpAc6Dla2mk5ef7onsG91tziIRr41rj4sVt3BOLLZw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAUMAqL/HCYu93BDY8VJZJJHpUHBPnxXYBoZuVZz6JIIAiEAkkEjQ1yIFrA+knxu08O4iLVoExshJGgoQWe/4/7D9xo="}],"size":88764,"noattachment":false,"key":"/disparity/-/disparity-2.0.0.tgz"},"directories":{},"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":1428113732464,"_cnpm_publish_time":1428113732464,"dist-tags":{"latest":"3.2.0"}}