{"_id":"patch-text","_rev":"331053","name":"patch-text","description":"Make multiple changes to a block of text by providing start and end indices and replacement text","dist-tags":{"latest":"1.0.2"},"maintainers":[{"name":"bendrucker","email":"bvdrucker@gmail.com"}],"time":{"modified":"2021-06-07T02:46:28.000Z","created":"2015-06-05T03:09:55.700Z","1.0.2":"2015-06-05T03:10:34.854Z","1.0.1":"2015-06-05T03:09:55.700Z"},"users":{"sbruchmann":true},"author":{"name":"Ben Drucker","email":"bvdrucker@gmail.com","url":"bendrucker.me"},"repository":{"type":"git","url":"git+https://github.com/bendrucker/patch-text.git"},"versions":{"1.0.2":{"name":"patch-text","main":"index.js","version":"1.0.2","description":"Make multiple changes to a block of text by providing start and end indices and replacement text","license":"MIT","repository":{"type":"git","url":"git+https://github.com/bendrucker/patch-text.git"},"author":{"name":"Ben Drucker","email":"bvdrucker@gmail.com","url":"bendrucker.me"},"engines":{"node":">=0.10.0"},"scripts":{"test":"standard && tape test.js"},"keywords":["replace","code","index"],"dependencies":{},"devDependencies":{"tape":"^4.0.0","standard":"^4.0.0"},"files":["index.js","readme.md"],"gitHead":"ff24212957baac2f618075d3c5171c2e2284a853","bugs":{"url":"https://github.com/bendrucker/patch-text/issues"},"homepage":"https://github.com/bendrucker/patch-text#readme","_id":"patch-text@1.0.2","_shasum":"4bf36e65e51733d6e98f0cf62e09034daa0348ac","_from":".","_npmVersion":"2.10.1","_nodeVersion":"2.1.0","_npmUser":{"name":"bendrucker","email":"bvdrucker@gmail.com"},"maintainers":[{"name":"bendrucker","email":"bvdrucker@gmail.com"}],"dist":{"shasum":"4bf36e65e51733d6e98f0cf62e09034daa0348ac","size":1770,"noattachment":false,"key":"/patch-text/-/patch-text-1.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/patch-text/download/patch-text-1.0.2.tgz"},"directories":{},"publish_time":1433473834854,"_cnpm_publish_time":1433473834854,"_hasShrinkwrap":false},"1.0.1":{"name":"patch-text","main":"index.js","version":"1.0.1","description":"Make multiple changes to a block of text be providing start and end indices and replacement text","license":"MIT","repository":{"type":"git","url":"git+https://github.com/bendrucker/patch-text.git"},"author":{"name":"Ben Drucker","email":"bvdrucker@gmail.com","url":"bendrucker.me"},"engines":{"node":">=0.10.0"},"scripts":{"test":"standard && tape test.js"},"keywords":["replace","code","index"],"dependencies":{},"devDependencies":{"tape":"^4.0.0","standard":"^4.0.0"},"files":["index.js","readme.md"],"gitHead":"14d75d40e920745f29bb69647a77e7957cfc0041","bugs":{"url":"https://github.com/bendrucker/patch-text/issues"},"homepage":"https://github.com/bendrucker/patch-text#readme","_id":"patch-text@1.0.1","_shasum":"e7c3f4536210bce796823223bc0fe0a985889c14","_from":".","_npmVersion":"2.10.1","_nodeVersion":"2.1.0","_npmUser":{"name":"bendrucker","email":"bvdrucker@gmail.com"},"maintainers":[{"name":"bendrucker","email":"bvdrucker@gmail.com"}],"dist":{"shasum":"e7c3f4536210bce796823223bc0fe0a985889c14","size":1774,"noattachment":false,"key":"/patch-text/-/patch-text-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/patch-text/download/patch-text-1.0.1.tgz"},"directories":{},"publish_time":1433473795700,"_cnpm_publish_time":1433473795700,"_hasShrinkwrap":false}},"readme":"# patch-text [![Build Status](https://travis-ci.org/bendrucker/patch-text.svg?branch=master)](https://travis-ci.org/bendrucker/patch-text)\n\n> Make multiple changes to a block of text by providing start and end indices and replacement text\n\n\n## Install\n\n```\n$ npm install --save patch-text\n```\n\n\n## Usage\n\n```js\nvar patch = require('patch-text');\nvar text = 'Hello guys!'\nvar updated = patch(text, [\n  {\n    start: 0,\n    end: 5,\n    replacement: 'Hi'\n  },\n  {\n    start: 7,\n    end: 9,\n    replacement: 'al'\n  }\n])\n// => 'Hi gals!'\n```\n\nYour patches shouldn't overlap, but they can shrink or increase the character count and your patches will still apply to the right text. \n\n## API\n\n#### `patch(text, patches)` -> `string`\n\n##### text\n\n*Required*  \nType: `string`\n\nThe text to patch.\n\n##### patches\n\n*Required*  \nType: `array[object]`\n\nThe patches to apply to the text, each with:\n\n* start (number)\n* end (number)\n* replacement (string)\n\n\n## License\n\nMIT © [Ben Drucker](http://bendrucker.me)\n","_attachments":{},"homepage":"https://github.com/bendrucker/patch-text#readme","bugs":{"url":"https://github.com/bendrucker/patch-text/issues"},"license":"MIT"}