{"_id":"replacements","_rev":"87770","name":"replacements","description":"Transform a string with an array of replacement patterns.","dist-tags":{"latest":"0.2.1"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"time":{"modified":"2021-06-03T10:28:31.000Z","created":"2014-07-05T21:55:39.801Z","0.2.1":"2015-12-20T14:53:34.361Z","0.2.0":"2015-03-13T13:07:24.133Z","0.1.3":"2014-07-08T05:43:26.532Z","0.1.2":"2014-07-08T05:42:26.733Z","0.1.1":"2014-07-05T22:40:29.596Z","0.1.0":"2014-07-05T21:55:39.801Z"},"users":{},"author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git+https://github.com/jonschlinkert/replacements.git"},"versions":{"0.2.1":{"name":"replacements","description":"Transform a string with an array of replacement patterns.","version":"0.2.1","homepage":"https://github.com/jonschlinkert/replacements","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git+https://github.com/jonschlinkert/replacements.git"},"bugs":{"url":"https://github.com/jonschlinkert/replacements/issues"},"license":"MIT","files":["index.js"],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha"},"devDependencies":{"mocha":"*","should":"*"},"keywords":["escape","expression","match","modify","pattern","regex","regular expression","replace","replacement","search","structure","substitute"],"verb":{"layout":"default","related":{"list":["easy-renamer"]},"plugins":["gulp-format-md"]},"gitHead":"9fd5647bbb2b858b81b286a78fe9768a522ccf8a","_id":"replacements@0.2.1","_shasum":"bff40a6949b5985c6809446457c2c2044c81b349","_from":".","_npmVersion":"3.3.6","_nodeVersion":"5.0.0","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"shasum":"bff40a6949b5985c6809446457c2c2044c81b349","size":2585,"noattachment":false,"key":"/replacements/-/replacements-0.2.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/replacements/download/replacements-0.2.1.tgz"},"directories":{},"publish_time":1450623214361,"_cnpm_publish_time":1450623214361,"_hasShrinkwrap":false},"0.2.0":{"name":"replacements","description":"Transform a string with an array of replacement patterns.","version":"0.2.0","homepage":"https://github.com/jonschlinkert/replacements","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git://github.com/jonschlinkert/replacements.git"},"bugs":{"url":"https://github.com/jonschlinkert/replacements/issues"},"license":{"type":"MIT","url":"https://github.com/jonschlinkert/replacements/blob/master/LICENSE"},"files":["index.js"],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha"},"devDependencies":{"mocha":"*","should":"^5.2.0"},"keywords":["regex","regular expression","escape","expression","match","modify","pattern","replace","replacement","search","structure","substitute"],"gitHead":"547844fdeaad0104df77dea22111236de1eac354","_id":"replacements@0.2.0","_shasum":"854b539a312fe8d8b0120b9e95e712eb44cce24e","_from":".","_npmVersion":"2.5.1","_nodeVersion":"0.12.0","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"shasum":"854b539a312fe8d8b0120b9e95e712eb44cce24e","size":2190,"noattachment":false,"key":"/replacements/-/replacements-0.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/replacements/download/replacements-0.2.0.tgz"},"directories":{},"publish_time":1426252044133,"_cnpm_publish_time":1426252044133,"_hasShrinkwrap":false},"0.1.3":{"name":"replacements","description":"Run multiple regex or string find-and-replace transformations on a string in sequence, reducing the final string to the accumulated result of all transformations.","version":"0.1.3","homepage":"https://github.com/jonschlinkert/replacements","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git://github.com/jonschlinkert/replacements.git"},"bugs":{"url":"https://github.com/jonschlinkert/replacements/issues"},"licenses":[{"type":"MIT","url":"https://github.com/jonschlinkert/replacements/blob/master/LICENSE-MIT"}],"keywords":["escape","expression","expressions","find","format","locate","match","matches","modify","pattern","patterns","re","regex","regexp","regular","replace","replaced","replacement","replacements","search","sluggifier","slugification","slugified","slugify","string","strings","structure","substitute","template","templates","tranformation","transform","un-escape","unescape","url","util","utils","utility"],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha -R spec"},"devDependencies":{"verb":"~0.2.6","chai":"~1.9.1","mocha":"*"},"_id":"replacements@0.1.3","_shasum":"a4151b04105857dc58982300b5f1b9f5ebe0c91d","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"shasum":"a4151b04105857dc58982300b5f1b9f5ebe0c91d","size":3669,"noattachment":false,"key":"/replacements/-/replacements-0.1.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/replacements/download/replacements-0.1.3.tgz"},"directories":{},"publish_time":1404798206532,"_cnpm_publish_time":1404798206532,"_hasShrinkwrap":false},"0.1.2":{"name":"replacements","description":"Run multiple regex or string find-and-replace transformations on a string in sequence, reducing the final string to the accumulated result of all transformations.","version":"0.1.2","homepage":"https://github.com/jonschlinkert/replacements","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git://github.com/jonschlinkert/replacements.git"},"bugs":{"url":"https://github.com/jonschlinkert/replacements/issues"},"licenses":[{"type":"MIT","url":"https://github.com/jonschlinkert/replacements/blob/master/LICENSE-MIT"}],"keywords":["escape","expression","expressions","find","format","locate","match","matches","modify","pattern","patterns","re","regex","regexp","regular","replace","replaced","replacement","replacements","search","sluggifier","slugification","slugified","slugify","string","strings","structure","substitute","template","templates","tranformation","transform","un-escape","unescape","url","util","utils","utility"],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha -R spec"},"devDependencies":{"verb":"~0.2.6","chai":"~1.9.1","mocha":"*"},"_id":"replacements@0.1.2","_shasum":"d7f4e197104de5f6e359ca98ce1474fb9b2fc41f","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"shasum":"d7f4e197104de5f6e359ca98ce1474fb9b2fc41f","size":3672,"noattachment":false,"key":"/replacements/-/replacements-0.1.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/replacements/download/replacements-0.1.2.tgz"},"directories":{},"publish_time":1404798146733,"_cnpm_publish_time":1404798146733,"_hasShrinkwrap":false},"0.1.1":{"name":"replacements","description":"Run multiple regex or string find-and-replace transformations on a string in sequence, reducing the final string to the accumulated result of all transformations.","version":"0.1.1","homepage":"https://github.com/jonschlinkert/replacements","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git://github.com/jonschlinkert/replacements.git"},"bugs":{"url":"https://github.com/jonschlinkert/replacements/issues"},"licenses":[{"type":"MIT","url":"https://github.com/jonschlinkert/replacements/blob/master/LICENSE-MIT"}],"keywords":["escape","expression","expressions","find","format","locate","match","matches","modify","pattern","patterns","re","regex","regexp","regular","replace","replaced","replacement","replacements","search","sluggifier","slugification","slugified","slugify","string","strings","structure","substitute","template","templates","tranformation","transform","un-escape","unescape","url","util","utils","utility"],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha -R spec"},"devDependencies":{"verb":"~0.2.6","chai":"~1.9.1","mocha":"*"},"_id":"replacements@0.1.1","_shasum":"132e965146f8cc5357412533f9712b025dba6741","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"shasum":"132e965146f8cc5357412533f9712b025dba6741","size":3618,"noattachment":false,"key":"/replacements/-/replacements-0.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/replacements/download/replacements-0.1.1.tgz"},"directories":{},"publish_time":1404600029596,"_cnpm_publish_time":1404600029596,"_hasShrinkwrap":false},"0.1.0":{"name":"replacements","description":"Run multiple regex or string find-and-replace transformations on a string in sequence, reducing the final string to the accumulated result of each transformation.","version":"0.1.0","homepage":"https://github.com/jonschlinkert/replacements","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git://github.com/jonschlinkert/replacements.git"},"bugs":{"url":"https://github.com/jonschlinkert/replacements/issues"},"licenses":[{"type":"MIT","url":"https://github.com/jonschlinkert/replacements/blob/master/LICENSE-MIT"}],"keywords":["escape","expression","expressions","find","format","locate","match","matches","modify","pattern","patterns","re","regex","regexp","regular","replace","replaced","replacement","replacements","search","sluggifier","slugification","slugified","slugify","string","strings","structure","substitute","template","templates","tranformation","transform","un-escape","unescape","url","util","utils","utility"],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha -R spec"},"devDependencies":{"verb":"~0.2.6","chai":"~1.9.1","mocha":"*"},"_id":"replacements@0.1.0","_shasum":"5f0716c35223aa63a9752c692753d64b521b650d","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"shasum":"5f0716c35223aa63a9752c692753d64b521b650d","size":2997,"noattachment":false,"key":"/replacements/-/replacements-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/replacements/download/replacements-0.1.0.tgz"},"directories":{},"publish_time":1404597339801,"_cnpm_publish_time":1404597339801,"_hasShrinkwrap":false}},"readme":"# replacements [![NPM version](https://img.shields.io/npm/v/replacements.svg)](https://www.npmjs.com/package/replacements) [![Build Status](https://img.shields.io/travis/jonschlinkert/replacements.svg)](https://travis-ci.org/jonschlinkert/replacements)\n\n> Transform a string with an array of replacement patterns.\n\n- [Install](#install)\n- [Usage](#usage)\n  * [object of replacement patterns](#object-of-replacement-patterns)\n  * [key-value replacement patterns](#key-value-replacement-patterns)\n  * [array of replacement patterns](#array-of-replacement-patterns)\n  * [functions as replacements](#functions-as-replacements)\n- [Related projects](#related-projects)\n- [Running tests](#running-tests)\n- [Contributing](#contributing)\n- [Author](#author)\n- [License](#license)\n\n_(TOC generated by [verb](https://github.com/verbose/verb))_\n\n## Install\n\nInstall with [npm](https://www.npmjs.com/)\n\n```sh\n$ npm i replacements --save\n```\n\n## Usage\n\n```js\nvar replace = require('replacements');\n```\n\n### object of replacement patterns\n\n```js\nvar transformers = {\n  pattern: /a/g,\n  replacement: 'bbb'\n};\nconsole.log(replace('aaa', transformers));\n//=> 'bbbbbbbbb'\n```\n\n### key-value replacement patterns\n\nFor basic string transformations, you can pass the string to replace as the key, and the replacement as a value:\n\n```js\nvar transformers = {\n  'a': 'b'\n  'c': 'd'\n};\nconsole.log(replace('aaabbbccc', transformers));\n//=> 'bbbbbbddd'\n```\n\n_Note that only the first matching string will only be replaced using this format. If you need more flexibility, use the pattern-replacement regex syntax._.\n\n### array of replacement patterns\n\n```js\nvar transformers = [\n  {pattern: /a/g, replacement: 'bbb'},\n  {pattern: /b/g, replacement: 'ccc'},\n  {pattern: /c/g, replacement: 'ddd'},\n  {pattern: /d/g, replacement: 'eee'},\n  {pattern: /[e]+/g, replacement: '_DONE_'}\n];\nconsole.log(replace('aaa', transformers));\n//=> '__DONE__'\n```\n\n### functions as replacements\n\n```js\nvar transformers = {\n  pattern: /a+/g,\n  replacement: function(match) {\n    return match.split('').map(function(str, i) {\n      if (i === 0) {return 'b'; }\n      if (i === 1) {return str.toUpperCase();}\n      return str;\n    }).join('');\n  }\n};\nconsole.log(replace('aaa', transformers));\n//=> 'bAa'\n```\n\n## Related projects\n\n[easy-renamer](https://www.npmjs.com/package/easy-renamer): Easily rename files using custom rename functions that are automatically used against any filepaths that… [more](https://www.npmjs.com/package/easy-renamer) | [homepage](https://github.com/jonschlinkert/easy-renamer)\n\n## Running tests\n\nInstall dev dependencies:\n\n```sh\n$ npm i -d && npm test\n```\n\n## Contributing\n\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/replacements/issues/new).\n\n## Author\n\n**Jon Schlinkert**\n\n* [github/jonschlinkert](https://github.com/jonschlinkert)\n* [twitter/jonschlinkert](http://twitter.com/jonschlinkert)\n\n## License\n\nCopyright © 2015 [Jon Schlinkert](https://github.com/jonschlinkert)\nReleased under the MIT license.\n\n***\n\n_This file was generated by [verb](https://github.com/verbose/verb) on December 20, 2015._","_attachments":{},"homepage":"https://github.com/jonschlinkert/replacements","bugs":{"url":"https://github.com/jonschlinkert/replacements/issues"},"license":"MIT"}