{"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","tarball":"http://registry-npm.ywwl.com/replacements/download/replacements-0.1.1.tgz","integrity":"sha512-C3JygwHe1lipeNR547NHd5ILDT09MNkfsJSqvaSWDrkXV4GZE1UGp4UtOS1h2WHK7M0qN+u6x8wpIq4jc+XH9A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCPblmMXDTQDWRQYV7FQHqyTONCGaKPUsA7p+gv+PKQpQIhAJzQPLPA31vAp/b+1bmfLpeLvc1IcoQ4m6hLqyfkvlSM"}],"size":3618,"noattachment":false,"key":"/replacements/-/replacements-0.1.1.tgz"},"directories":{},"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._","publish_time":1404600029596,"_cnpm_publish_time":1404600029596,"dist-tags":{"latest":"0.2.1"}}