{"_id":"diff-frag","_rev":"223630","name":"diff-frag","description":"Take a big diff with a 2-line header and turn it into frags with only a reasonable amount of context","dist-tags":{"latest":"1.1.1"},"maintainers":[{"name":"isaacs","email":""}],"time":{"modified":"2021-06-03T15:41:28.000Z","created":"2019-11-21T06:36:02.483Z","1.1.1":"2021-03-31T19:19:14.918Z","1.1.0":"2021-03-31T18:52:55.623Z","1.0.1":"2019-11-21T06:37:39.405Z","1.0.0":"2019-11-21T06:36:02.483Z"},"users":{},"author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"https://izs.me"},"versions":{"1.1.1":{"name":"diff-frag","version":"1.1.1","description":"Take a big diff with a 2-line header and turn it into frags with only a reasonable amount of context","author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"https://izs.me"},"license":"ISC","scripts":{"snap":"tap","test":"tap","preversion":"npm test","postversion":"npm publish","prepublishOnly":"git push origin --follow-tags"},"tap":{"check-coverage":true},"devDependencies":{"tap":"^14.9.2"},"funding":{"url":"https://github.com/sponsors/isaacs"},"engines":{"node":">=10"},"gitHead":"ed00e61d4face4e724636b4743f32ca1c4e6dc47","_id":"diff-frag@1.1.1","_nodeVersion":"15.3.0","_npmVersion":"7.7.6","dist":{"shasum":"3f4f00e16dc55e283cc2ed9fe1487d1abed76bde","size":4022,"noattachment":false,"key":"/diff-frag/-/diff-frag-1.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/diff-frag/download/diff-frag-1.1.1.tgz"},"_npmUser":{"name":"isaacs","email":"i@izs.me"},"directories":{},"maintainers":[{"name":"isaacs","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/diff-frag_1.1.1_1617218354742_0.019324973054328565"},"_hasShrinkwrap":false,"publish_time":1617218354918,"_cnpm_publish_time":1617218354918},"1.1.0":{"name":"diff-frag","version":"1.1.0","description":"Take a big diff with a 2-line header and turn it into frags with only a reasonable amount of context","author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"https://izs.me"},"license":"ISC","scripts":{"snap":"tap","test":"tap","preversion":"npm test","postversion":"npm publish","prepublishOnly":"git push origin --follow-tags"},"tap":{"check-coverage":true},"devDependencies":{"tap":"^14.9.2"},"funding":{"url":"https://github.com/sponsors/isaacs"},"engines":{"node":">=10"},"gitHead":"bb2a1b2a651f7d511a09346496405792eab4d0b0","_id":"diff-frag@1.1.0","_nodeVersion":"15.3.0","_npmVersion":"7.7.6","dist":{"shasum":"35d8d76f1331a1c2ac29f98b44f6ca9a470c1be5","size":4022,"noattachment":false,"key":"/diff-frag/-/diff-frag-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/diff-frag/download/diff-frag-1.1.0.tgz"},"_npmUser":{"name":"isaacs","email":"i@izs.me"},"directories":{},"maintainers":[{"name":"isaacs","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/diff-frag_1.1.0_1617216775476_0.7052838969252331"},"_hasShrinkwrap":false,"publish_time":1617216775623,"_cnpm_publish_time":1617216775623},"1.0.1":{"name":"diff-frag","version":"1.0.1","description":"Take a big diff with a 2-line header and turn it into frags with only a reasonable amount of context","author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"https://izs.me"},"license":"ISC","scripts":{"test":"tap","preversion":"npm test","postversion":"npm publish","postpublish":"git push origin --follow-tags"},"tap":{"check-coverage":true},"devDependencies":{"tap":"^14.9.2"},"funding":{"url":"https://github.com/sponsors/isaacs"},"gitHead":"8a018258c21b8e7074d6631b412956c84ec31295","_id":"diff-frag@1.0.1","_nodeVersion":"12.12.0","_npmVersion":"6.13.1","dist":{"shasum":"a7bb51789743e8c0b40e2509166bd155e5833826","size":2398,"noattachment":false,"key":"/diff-frag/-/diff-frag-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/diff-frag/download/diff-frag-1.0.1.tgz"},"maintainers":[{"name":"isaacs","email":""}],"_npmUser":{"name":"isaacs","email":"i@izs.me"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/diff-frag_1.0.1_1574318259189_0.9084394099490205"},"_hasShrinkwrap":false,"publish_time":1574318259405,"_cnpm_publish_time":1574318259405},"1.0.0":{"name":"diff-frag","version":"1.0.0","description":"Take a big diff with a 2-line header and turn it into frags with only a reasonable amount of context","author":{"name":"Isaac Z. Schlueter","email":"i@izs.me","url":"https://izs.me"},"license":"ISC","scripts":{"test":"tap","preversion":"npm test","postversion":"npm publish","postpublish":"git push origin --follow-tags"},"tap":{"check-coverage":true},"devDependencies":{"tap":"^14.9.2"},"funding":{"url":"https://github.com/sponsors/isaacs"},"gitHead":"ec08ed829c1ad1db60559cb609c93139b122b85c","_id":"diff-frag@1.0.0","_nodeVersion":"12.12.0","_npmVersion":"6.13.1","dist":{"shasum":"de3405b09be58d744db3d8d749b5a849ed8f0721","size":44745,"noattachment":false,"key":"/diff-frag/-/diff-frag-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/diff-frag/download/diff-frag-1.0.0.tgz"},"maintainers":[{"name":"isaacs","email":""}],"_npmUser":{"name":"isaacs","email":"i@izs.me"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/diff-frag_1.0.0_1574318162341_0.5731649720389702"},"_hasShrinkwrap":false,"publish_time":1574318162483,"_cnpm_publish_time":1574318162483}},"readme":"# diff-frag\n\nTake a big diff with or without a 2-line header and turn it into frags with\nonly a reasonable amount of context\n\nFor example, you might have a program that spits out a diff like this:\n\n```diff\nsome header data\nAuthor: Bobo The Cat <bobo@cat.kitty>\nDate: Wed Nov 20 20:13:08 2019 -0800\n\ndiff --git a/bowl.txt b/bowl.txt\nindex glorp..prolg 100655\n--- a/bowl.txt\n+++ b/bowl.txt\n space-prefixed lines are the same in both\n but we were sloppy in what got included in the diff\n\n this can happen if you tell git to output a LOT of context, or if you\n have a program that diffs objects in a naive way.\n\n so you get 1000 lines of identical output ...\n\n but dumping that all to ta teerminal is so ruuuuuude\n\n-what you want\n+what you want is just this bit\n+ just the changes\n\n more more more more more.... it goes on and on for a long time...\n```\n\nIn that case, what you'd really prefer is something like:\n\n```diff\nsome header data\nAuthor: Bobo The Cat <bobo@cat.kitty>\nDate: Wed Nov 20 20:13:08 2019 -0800\n\ndiff --git a/bowl.txt b/bowl.txt\nindex glorp..prolg 100655\n--- a/bowl.txt\n+++ b/bowl.txt\n@@ -1000,6 +1000,7 @@ so you get 1000 lines of identical...\n\n but dumping that all to ta teerminal is so ruuuuuude\n\n-what you want\n+what you want is just this bit\n+just the changes\n\n more more more more more.... it goes on and on for a long time...\n@@ -2456,5 +2567,5 @@ another bit of context here\n\n+ added line\n+ well, you get\n- removed line\n- the idea\n\n just the changes, is what I'm saying, not the 1000 lines between.\n```\n\nThis function will take the first kind of string, and turn it into the\nsecond.  It's useful for [test frameworks](https://node-tap.org) that\npretty-print object diffs, for object matching assertions, and want to make\nthem prettier when the object is really big.\n\n## USAGE\n\n```js\nconst diffFrag = require('diff-frag')\n// options are optional, you don't have to pass that in\nconst fraggedDiff = diffFrag(rawDiff, options)\n// that's it, it's just the one function\n```\n\n## OPTIONS\n\n* `contextLines` How many lines of context to show?  Default = 3\n* `hasHeader` Set to `true` to indicate that there is a header separated by\n  `--- oldName\\n+++ newName\\n` lines.  Set to `false` to indicate that\n  you're definitely only sending just the `+/-/' '`-prefixed diff parts.\n  Leave it as the default `null` to tell diffFrag to try to figure it out.\n* `oldName` Only relevant if the header can't be found, otherwise it'll use\n  the oldName in the header that the diff already has.\n* `oldHeader` Only relevant if the header can't be found, otherwise it'll\n  use the oldHeader in the header that the diff already has.\n* `newName` Only relevant if the header can't be found, otherwise it'll use\n  the newName in the header that the diff already has.\n* `newHeader` Only relevant if the header can't be found, otherwise it'll\n  use the newHeader in the header that the diff already has.\n\nA `---/+++` header is always attached to the diff it returns.  If a header\nis found in the diff you provide, then it'll use the names it finds,\notherwise it's generated as:\n\n```js\n`---${oldName}\\t${oldHeader}\\n+++${newName}\\t${newHeader}`\n```\n","_attachments":{},"license":"ISC"}