{"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":{"integrity":"sha512-n94Rzbv2ambRaFzrnBf34IEiyOdIci7maRpMkoQWB6xFYGA7Nbs0Z5YQzMfTeyQeelv23nayqOcssBoc6rKrgw==","shasum":"605288e8ebf38c5ccfe1e0dbc49ca6f724096500","tarball":"http://registry-npm.ywwl.com/disparity/download/disparity-3.0.0.tgz","fileCount":7,"unpackedSize":13303,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdw1UoCRA9TVsSAnZWagAARlQQAIbvOq54ARLQbgmj8cCL\n3k03G7D9bpDNJSwc65REa4RGgWFAvBfUe4gK76E+fi1xzejwI4xJ3N5kxwAL\nOZcL2Xi91de5M6QF1aeR70GFvriIq8/pMCw0vN0Et/ByTDj27yrgGSEly7X+\nARoeOWLUOkqMDjvNm+KyBamF4tYJNR6OF2R2NBG3y85A5COpDwhHl+N51F4C\nqZUnDT3o8mwjlvM6WXysb/kKZV40Jt5VvwVd1qNTZtxhVSDrFspV/+KJyJQS\nidTqdtAJZe2mflQwFYEYFavCGzYqRW0vJprqoWai6CkE0gVD1BAWGzWpMlVj\nTlQUyaH3Rztooacy+r04yMyr31W499xaXMBLlxklgNbeh2RZJqgdKCggUzXp\nJA5bdxTLolTOtj0CBCsCzA8GQ9IPpPfOeE6DELK628Z2CKiC0Z/TMVM4aEoP\nCiu8f8htIdrrFRxhvooV3aAwqgYUvGuHI2DUYCOng4ePDL9eigEYowt3zIYV\nbszGT18sY8tYZk/43H5sjki3AtsawuGTyi2RBxbZV77sHUFLcWIOHBuH5/09\nysq0g8ZHKnNymd64wMCCVvc+k4V4zkp87VHAMeypcCKhbzc1nJDtJqEI/tWx\nL+VOd/PV4A2sFJy/P4W1VaA/zq4G6x0twdgX6X0mR4b7D2ZLluwY25dURua6\ndHRl\r\n=VkzV\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD6PTy5GPokTqTRKK23Toc0/EYpgITYmePKAR3uOrBHHAIgV6QdpnT9zJAevjWj4MBQJiG6x6PFaEJ1MPjdC1EUMM0="}],"size":5159,"noattachment":false,"key":"/disparity/-/disparity-3.0.0.tgz"},"maintainers":[{"name":"millermedeiros","email":"miller@millermedeiros.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/disparity_3.0.0_1573082408045_0.4023005817023646"},"_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":1573082408126,"_cnpm_publish_time":1573082408126,"dist-tags":{"latest":"3.2.0"}}