{"_id":"frep","_rev":"83183","name":"frep","description":"Find and replace utility for node.js. Transform strings by running multiple RegExp or string find-and-replace patterns on a string in sequence, reducing the final string to the accumulated result of each transformation. Patterns can be strings (or arrays ","dist-tags":{"latest":"0.2.3"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"time":{"modified":"2021-06-03T10:26:29.000Z","created":"2013-09-18T08:51:07.555Z","0.2.3":"2014-07-05T22:51:59.008Z","0.2.2":"2014-06-10T23:52:57.904Z","0.2.1":"2014-05-14T17:11:29.894Z","0.2.0":"2014-03-30T06:34:37.531Z","0.1.8":"2014-03-28T18:36:10.655Z","0.1.7":"2014-03-07T20:25:48.434Z","0.1.6":"2014-02-16T20:23:36.313Z","0.1.5":"2014-02-12T06:05:46.903Z","0.1.4":"2014-02-12T05:30:41.143Z","0.1.3":"2014-01-22T23:07:00.720Z","0.1.2":"2013-10-03T03:24:03.181Z","0.1.1":"2013-09-23T00:00:01.784Z","0.1.0":"2013-09-18T08:51:07.555Z"},"users":{"jonschlinkert":true,"alcovegan":true,"broughtback":true},"author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"https://github.com/jonschlinkert/frep.git"},"versions":{"0.2.3":{"name":"frep","description":"Find and replace utility for node.js. Transform strings by running multiple RegExp or string find-and-replace patterns on a string in sequence, reducing the final string to the accumulated result of each transformation. Patterns can be strings (or arrays ","version":"0.2.3","homepage":"https://github.com/jonschlinkert/frep","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"https://github.com/jonschlinkert/frep.git"},"bugs":{"url":"https://github.com/jonschlinkert/frep/issues"},"licenses":[{"type":"MIT","url":"https://github.com/jonschlinkert/frep/blob/master/LICENSE-MIT"}],"main":"index.js","engines":{"node":">= 0.8.0"},"scripts":{"test":"mocha -R spec"},"keywords":["expression","expressions","find","format","match","matches","modify","pattern","patterns","regex","regexp","regular","replace","replaced","replacement","replacements","search","sluggifier","slugification","slugified","slugify","string","strings","structure","substitute","tranformation","transform","underscore","url","utility"],"devDependencies":{"chai":"^1.9.1","mocha":"^1.18.2","underscore.string":"^2.3.3","verb":"^0.2.7"},"dependencies":{"replacements":"^0.1.1"},"_id":"frep@0.2.3","_shasum":"b7580fa65ea62a1cf8ea1ef7741dee92a8458f7c","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"shasum":"b7580fa65ea62a1cf8ea1ef7741dee92a8458f7c","size":6175,"noattachment":false,"key":"/frep/-/frep-0.2.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/frep/download/frep-0.2.3.tgz"},"directories":{},"publish_time":1404600719008,"_cnpm_publish_time":1404600719008,"_hasShrinkwrap":false},"0.2.2":{"name":"frep","description":"Find, replace and string tranformation utility for node.js. Modify strings by passing an array or object of RegExp or string replacement patterns. Patterns can be strings, arrays of strings or regex, replacements can be strings or functions.","version":"0.2.2","homepage":"https://github.com/jonschlinkert/frep","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"https://github.com/jonschlinkert/frep.git"},"bugs":{"url":"https://github.com/jonschlinkert/frep/issues"},"licenses":[{"type":"MIT","url":"https://github.com/jonschlinkert/frep/blob/master/LICENSE-MIT"}],"main":"index.js","engines":{"node":">= 0.8.0"},"scripts":{"test":"mocha -R spec"},"keywords":["expression","expressions","find","format","match","matches","modify","pattern","patterns","regex","regexp","regular","replace","replaced","replacement","replacements","search","sluggifier","slugification","slugified","slugify","string","strings","structure","substitute","tranformation","transform","underscore","url","utility"],"devDependencies":{"chai":"^1.9.1","mocha":"^1.18.2","underscore.string":"^2.3.3","verb":"^0.2.7"},"_id":"frep@0.2.2","_shasum":"46b448af8e2630710b32d54ddda73a32ee2b2538","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"shasum":"46b448af8e2630710b32d54ddda73a32ee2b2538","size":5939,"noattachment":false,"key":"/frep/-/frep-0.2.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/frep/download/frep-0.2.2.tgz"},"directories":{},"publish_time":1402444377904,"_cnpm_publish_time":1402444377904,"_hasShrinkwrap":false},"0.2.1":{"name":"frep","description":"Find, replace and string tranformation utility for node.js. Modify strings by passing an array or object of RegExp or string replacement patterns. Patterns can be strings, arrays of strings or regex, replacements can be strings or functions.","version":"0.2.1","homepage":"https://github.com/jonschlinkert/frep","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"https://github.com/jonschlinkert/frep.git"},"bugs":{"url":"https://github.com/jonschlinkert/frep/issues"},"licenses":[{"type":"MIT","url":"https://github.com/jonschlinkert/frep/blob/master/LICENSE-MIT"}],"main":"index.js","engines":{"node":">= 0.8.0"},"scripts":{"test":"mocha -R spec"},"keywords":["expression","expressions","find","format","match","matches","modify","pattern","patterns","regex","regexp","regular","replace","replaced","replacement","replacements","search","sluggifier","slugification","slugified","slugify","string","strings","structure","substitute","tranformation","transform","underscore","url","utility"],"devDependencies":{"chai":"^1.9.1","mocha":"^1.18.2","underscore.string":"^2.3.3","verb":"^0.2.7"},"_id":"frep@0.2.1","_shasum":"2b4fba6bb3c84fbfa0bff8a6b4b95dcd6d99e2b5","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"shasum":"2b4fba6bb3c84fbfa0bff8a6b4b95dcd6d99e2b5","size":5824,"noattachment":false,"key":"/frep/-/frep-0.2.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/frep/download/frep-0.2.1.tgz"},"directories":{},"publish_time":1400087489894,"_cnpm_publish_time":1400087489894,"_hasShrinkwrap":false},"0.2.0":{"name":"frep","description":"A find and replace utility. Modify strings by passing an array or object of RegExp or string replacement patterns","version":"0.2.0","homepage":"https://github.com/jonschlinkert/frep","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"https://github.com/jonschlinkert/frep.git"},"bugs":{"url":"https://github.com/jonschlinkert/frep/issues"},"licenses":[{"type":"MIT","url":"https://github.com/jonschlinkert/frep/blob/master/LICENSE-MIT"}],"main":"index.js","engines":{"node":">= 0.8.0"},"scripts":{"test":"mocha -R test"},"keywords":["find","and","replace","javascript","regex","match","regular","expression","js","pattern","regexp","expressions","replacement","patterns","replacements"],"dependencies":{"lodash":"~2.4.1"},"devDependencies":{"underscore.string":"~2.3.3","chai":"~1.9.0","mocha":"~1.17.1","verb":"~0.1.20"},"_id":"frep@0.2.0","dist":{"shasum":"5f8a622263982df6bd63a51b0c78a4c7a34dbe57","size":5589,"noattachment":false,"key":"/frep/-/frep-0.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/frep/download/frep-0.2.0.tgz"},"_from":".","_npmVersion":"1.3.24","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"directories":{},"publish_time":1396161277531,"_hasShrinkwrap":false,"_cnpm_publish_time":1396161277531},"0.1.8":{"name":"frep","description":"A find and replace utility. Modify strings by passing an array or object of RegExp or string replacement patterns","version":"0.1.8","homepage":"https://github.com/jonschlinkert/frep","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"https://github.com/jonschlinkert/frep.git"},"bugs":{"url":"https://github.com/jonschlinkert/frep/issues"},"licenses":[{"type":"MIT","url":"https://github.com/jonschlinkert/frep/blob/master/LICENSE-MIT"}],"main":"index.js","engines":{"node":">= 0.8.0"},"keywords":["find","and","replace","javascript","regex","match","regular","expression","js","pattern","regexp","expressions","replacement","patterns","replacements"],"dependencies":{"lodash":"~2.4.1"},"devDependencies":{"underscore.string":"~2.3.3","chai":"~1.9.0","mocha":"~1.17.1"},"_id":"frep@0.1.8","dist":{"shasum":"b5185efa5662e6ac6f4206a4e18d0967f21219da","size":4716,"noattachment":false,"key":"/frep/-/frep-0.1.8.tgz","tarball":"http://registry.cnpm.dingdandao.com/frep/download/frep-0.1.8.tgz"},"_from":".","_npmVersion":"1.3.24","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"directories":{},"publish_time":1396031770655,"_hasShrinkwrap":false,"_cnpm_publish_time":1396031770655},"0.1.7":{"name":"frep","description":"A find and replace utility. Modify strings by passing an array or object of RegExp or string replacement patterns","version":"0.1.7","homepage":"https://github.com/jonschlinkert/frep","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"https://github.com/jonschlinkert/frep.git"},"bugs":{"url":"https://github.com/jonschlinkert/frep/issues"},"licenses":[{"type":"MIT","url":"https://github.com/jonschlinkert/frep/blob/master/LICENSE-MIT"}],"main":"frep.js","engines":{"node":">= 0.8.0"},"keywords":["find and replace","find replace","find","javascript find replace","javascript regex match","javascript regex replace","javascript regular expression","js find replace","js regex replace","js regex","pattern","regex javascript","regex replace","regex","regexp","regular expressions","replace","replacement patterns","replacements"],"dependencies":{"lodash":"~2.4.1","underscore.string":"~2.3.3"},"devDependencies":{"chai":"~1.9.0","mocha":"~1.17.1"},"_id":"frep@0.1.7","dist":{"shasum":"6db165c70af0af78dac40d38567e19d206fcb423","size":13873,"noattachment":false,"key":"/frep/-/frep-0.1.7.tgz","tarball":"http://registry.cnpm.dingdandao.com/frep/download/frep-0.1.7.tgz"},"_from":".","_npmVersion":"1.3.24","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"directories":{},"publish_time":1394223948434,"_hasShrinkwrap":false,"_cnpm_publish_time":1394223948434},"0.1.6":{"name":"frep","description":"A find and replace utility. Modify strings by passing an array or object of RegExp or string replacement patterns","version":"0.1.6","homepage":"https://github.com/jonschlinkert/frep","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"https://github.com/jonschlinkert/frep.git"},"bugs":{"url":"https://github.com/jonschlinkert/frep/issues"},"licenses":[{"type":"MIT","url":"https://github.com/jonschlinkert/frep/blob/master/LICENSE-MIT"}],"main":"frep.js","engines":{"node":">= 0.8.0"},"keywords":["find and replace","find replace","find","javascript find replace","javascript regex match","javascript regex replace","javascript regular expression","js find replace","js regex replace","js regex","pattern","regex javascript","regex replace","regex","regexp","regular expressions","replace","replacement patterns","replacements"],"devDependencies":{"chai":"~1.9.0","mocha":"~1.17.1","lodash":"~2.4.1","underscore.string":"~2.3.3"},"_id":"frep@0.1.6","dist":{"shasum":"f10c42fefeb30e74ea41ad96809f87655c2af23f","size":13867,"noattachment":false,"key":"/frep/-/frep-0.1.6.tgz","tarball":"http://registry.cnpm.dingdandao.com/frep/download/frep-0.1.6.tgz"},"_from":".","_npmVersion":"1.3.24","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"directories":{},"publish_time":1392582216313,"_hasShrinkwrap":false,"_cnpm_publish_time":1392582216313},"0.1.5":{"name":"frep","description":"A find and replace utility. Modify strings by passing an array or object of RegExp or string replacement patterns","version":"0.1.5","homepage":"https://github.com/jonschlinkert/frep","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"https://github.com/jonschlinkert/frep.git"},"bugs":{"url":"https://github.com/jonschlinkert/frep/issues"},"licenses":[{"type":"MIT","url":"https://github.com/jonschlinkert/frep/blob/master/LICENSE-MIT"}],"main":"frep.js","engines":{"node":">= 0.8.0"},"keywords":["find and replace","find replace","find","javascript find replace","javascript regex match","javascript regex replace","javascript regular expression","js find replace","js regex replace","js regex","pattern","regex javascript","regex replace","regex","regexp","regular expressions","replace","replacement patterns","replacements"],"devDependencies":{"chai":"~1.9.0","mocha":"~1.17.1","lodash":"~2.4.1","underscore.string":"~2.3.3"},"_id":"frep@0.1.5","dist":{"shasum":"d96c03f4fb964bc0d135ff159f872fb2e3b70bae","size":31753,"noattachment":false,"key":"/frep/-/frep-0.1.5.tgz","tarball":"http://registry.cnpm.dingdandao.com/frep/download/frep-0.1.5.tgz"},"_from":".","_npmVersion":"1.3.24","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"directories":{},"publish_time":1392185146903,"_hasShrinkwrap":false,"_cnpm_publish_time":1392185146903},"0.1.4":{"name":"frep","description":"A find and replace utility. Modify strings by passing an array or object of RegExp or string replacement patterns","version":"0.1.4","homepage":"https://github.com/helpers/frep","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"https://github.com/helpers/frep.git"},"bugs":{"url":"https://github.com/helpers/frep/issues"},"licenses":[{"type":"MIT","url":"https://github.com/helpers/frep/blob/master/LICENSE-MIT"}],"main":"frep.js","engines":{"node":">= 0.8.0"},"keywords":["find replace","find","javascript regex match","javascript regex replace","javascript regular expression","js regex replace","js regex","pattern","regex javascript","regex replace","regex","regexp","regular expressions","replace","replacement patterns","replacements"],"_id":"frep@0.1.4","dist":{"shasum":"dbe89fe306133b8f47892e0cf86a808fe4758284","size":11168,"noattachment":false,"key":"/frep/-/frep-0.1.4.tgz","tarball":"http://registry.cnpm.dingdandao.com/frep/download/frep-0.1.4.tgz"},"_from":".","_npmVersion":"1.3.24","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"directories":{},"publish_time":1392183041143,"_hasShrinkwrap":false,"_cnpm_publish_time":1392183041143},"0.1.3":{"name":"frep","description":"A find and replace utility. Modify strings by passing an array or object of RegExp or string replacement patterns","version":"0.1.3","homepage":"https://github.com/helpers/frep","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"https://github.com/helpers/frep.git"},"bugs":{"url":"https://github.com/helpers/frep/issues"},"licenses":[{"type":"MIT","url":"https://github.com/helpers/frep/blob/master/LICENSE-MIT"}],"main":"frep.js","engines":{"node":">= 0.8.0"},"keywords":["find replace","find","javascript regex match","javascript regex replace","javascript regular expression","js regex replace","js regex","pattern","regex javascript","regex replace","regex","regexp","regular expressions","replace","replacement patterns","replacements"],"_id":"frep@0.1.3","dist":{"shasum":"a499d1498bc07a3a6e690ab264bc3ff79688eae8","size":10616,"noattachment":false,"key":"/frep/-/frep-0.1.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/frep/download/frep-0.1.3.tgz"},"_from":".","_npmVersion":"1.3.14","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"directories":{},"publish_time":1390432020720,"_hasShrinkwrap":false,"_cnpm_publish_time":1390432020720},"0.1.2":{"name":"frep","description":"A find and replace utility. Modify strings by passing an array or object of RegExp or string replacement patterns","version":"0.1.2","homepage":"https://github.com/helpers/frep","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"https://github.com/helpers/frep.git"},"bugs":{"url":"https://github.com/helpers/frep/issues"},"licenses":[{"type":"MIT","url":"https://github.com/helpers/frep/blob/master/LICENSE-MIT"}],"main":"frep.js","engines":{"node":">= 0.8.0"},"keywords":["find replace","find","javascript regex match","javascript regex replace","javascript regular expression","js regex replace","js regex","pattern","regex javascript","regex replace","regex","regexp","regular expressions","replace","replacement patterns","replacements"],"_id":"frep@0.1.2","dist":{"shasum":"4846e0a480f5dea20d143c83cf728d667f903437","size":2917,"noattachment":false,"key":"/frep/-/frep-0.1.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/frep/download/frep-0.1.2.tgz"},"_from":".","_npmVersion":"1.3.11","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"directories":{},"publish_time":1380770643181,"_hasShrinkwrap":false,"_cnpm_publish_time":1380770643181},"0.1.1":{"name":"frep","description":"A find and replace utility. Modify strings by passing an array of RegExp or string replacement patterns","version":"0.1.1","homepage":"https://github.com/helpers/frep","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"https://github.com/helpers/frep.git"},"bugs":{"url":"https://github.com/helpers/frep/issues"},"licenses":[{"type":"MIT","url":"https://github.com/helpers/frep/blob/master/LICENSE-MIT"}],"main":"frep.js","engines":{"node":">= 0.8.0"},"keywords":["find replace","regex","regexp","regular expressions","replacements","replacement patterns","pattern"],"_id":"frep@0.1.1","dist":{"shasum":"4c88650826665d221de0abe07f5ffaf47861e989","size":2298,"noattachment":false,"key":"/frep/-/frep-0.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/frep/download/frep-0.1.1.tgz"},"_from":".","_npmVersion":"1.2.25","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"directories":{},"publish_time":1379894401784,"_hasShrinkwrap":false,"_cnpm_publish_time":1379894401784},"0.1.0":{"name":"frep","description":"A find and replace utility. Modify strings by passing an array of RegExp or string replacement patterns","version":"0.1.0","homepage":"https://github.com/helpers/frep","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"https://github.com/helpers/frep.git"},"bugs":{"url":"https://github.com/helpers/frep/issues"},"licenses":[{"type":"MIT","url":"https://github.com/helpers/frep/blob/master/LICENSE-MIT"}],"main":"Gruntfile.js","engines":{"node":">= 0.8.0"},"keywords":["find replace","regex","regexp","regular expressions","replacements","replacement patterns","pattern"],"_id":"frep@0.1.0","dist":{"shasum":"8f1eb32df61031708a3fc9c5d834ab5350173075","size":2363,"noattachment":false,"key":"/frep/-/frep-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/frep/download/frep-0.1.0.tgz"},"_from":".","_npmVersion":"1.2.25","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"directories":{},"publish_time":1379494267555,"_hasShrinkwrap":false,"_cnpm_publish_time":1379494267555}},"readme":"# frep [![NPM version](https://badge.fury.io/js/frep.png)](http://badge.fury.io/js/frep)\n\n> Find, replace and string tranformation utility for node.js. Modify strings by passing an array or object of RegExp or string replacement patterns. Patterns can be strings, arrays of strings or regex, replacements can be strings or functions.\n\n## Quickstart\nInstall with [npm](npmjs.org):\n\n```bash\nnpm i frep --save-dev\n```\n\nUsage:\n\n```js\nvar replace = require('frep');\n\n// Patterns can be strings, regex or arrays.\n// Replacements can be strings or functions.\nvar replacements = [\n  {\n    pattern: 'a',\n    replacement: 'x'\n  },\n  {\n    pattern: /b/,\n    replacement: 'y'\n  },\n  {\n    pattern: /c[\\S]+/,\n    replacement: function(match) {\n      return match.toUpperCase();\n    }\n  }\n];\n\nconsole.log(replace.strWithArr('abcdefg', replacements));\n//=> 'xyCDEFG'\n```\n\n## API\n```js\n// Transform a string with an array of replacement patterns\nreplace.strWithArr(String, replacements);\n// Transform an array of strings with an array of replacement patterns\nreplace.arrWithArr(Array,  replacements);\n// Transform a string with an object of replacement patterns\nreplace.strWithObj(String, replacements);\n// Transform an array of strings with an object of replacement patterns\nreplace.arrWithObj(Array,  replacements);\n```\n\n### .strWithArr( string, array )\nTransform a string with an array of replacement patterns.\n\nParameters:\n\n* `String`: The string to modify with the given replacement patterns.\n* `Array`: Array of objects containing the replacement patterns, each including a `pattern` property (which can be a string or a RegExp), and a `replacement` property (which can be a string or a function to be called for each match).\n* A new string is returned with some or all matches replaced by the given replacement patterns.\n\n**Example 1**\n\nGiven the following:\n\n```js\nvar str = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'\nvar patterns = [\n  {\n    pattern: /[ABC]/g,\n    replacement: '###'\n  },\n  {\n    pattern: /[XYZ]/g,\n    replacement: '$$$'\n  },\n  ...\n];\n\nreplace.strWithArr(str, patterns));\n// => #########DEFGHIJKLMNOPQRSTUVW$$$$$$$$$\n```\n\n### patterns as arrays\nPatterns may also be arrays. When replacement patterns are formatted as arrays Frep will first transform the array into a corresponding RegExp group:\n\n**Example 2**\n\n```js\n['[ABC]', '[XYZ]']\n```\ngets converted to:\n\n```js\n /([ABC]|[XYZ])/gi\n ```\n\n**Example 3**\n\nSo the following will produce a similar result to **Example 1**, except `###` is used to replace all patterns:\n\n```js\nvar str = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'\nvar patterns = [\n  {\n    pattern: ['[ABC]', '[XYZ]'],\n    replacement: '###'\n  }\n];\n\nreplace.strWithArr(str, patterns));\n// => #########DEFGHIJKLMNOPQRSTUVW#########\n```\n\n### .arrWithArr( array, array )\nTransform an array of strings with an array of replacement patterns\n\nParameters:\n\n* `Array`: The string to modify with the given replacement patterns.\n* `Array`: Same as `replacStr`, this is an an array of objects containing the replacement patterns, each including a `pattern` property, which can be a string or a RegExp, and a `replacement` property, which can be a string or a function to be called for each match.\n* A new array of strings is returned with some or all matches replaced by the given replacement patterns.\n\nGiven the following:\n\n**Example 4**\n\n```js\nvar arr = [\n  'Jon Schlinkert',\n  'Brian Woodward'\n];\n\nvar patterns = [\n  {\n    pattern: /(B|S)/g,\n    replacement: '###'\n  },\n  {\n    pattern: /(J|W)/g,\n    replacement: '$$$'\n  },\n  ...\n];\n\nreplace.arrWithArr(arr, patterns));\n// => [\"$$$on ###chlinkert\", \"###rian $$$oodward\"]\n```\n\nAn array of new strings is returned, with some or all matches in each string replaced by the given replacement strings.\n\n\n\n### .strWithObj( string, object )\nTransform a string with an object of replacement patterns\n\nParameters:\n\n* `String`: The string to modify with the given replacement patterns.\n* `Object`: Object of replacement patterns, where each key is a string or a RegExp `pattern`, and each value is the `replacement` string or function to be called for each match.\n* A new string is returned with some or all matches replaced by the given replacement patterns.\n\n**Example 5**\n\nGiven the following:\n\n```js\nvar str = 'ABC'\nvar replacements = {\n  'A': 'AAA',\n  'B': 'BBB',\n  'C': 'CCC',\n  'D': 'DDD',\n  'E': 'EEE',\n  'F': 'FFF'\n};\n\nreplace.strWithObj(str, replacements));\n// => AAABBBCCC\n```\n\n\n### .arrWithObj( array, object )\nTransform an array of strings with an object of replacement patterns\n\nParameters:\n\n* `Array`: The array of strings to modify with the given replacement patterns.\n* `Object`: Object of replacement patterns, where each key is a string or a RegExp `pattern`, and each value is the `replacement` string or function to be called for each match.\n* A new array of strings is returned with some or all matches replaced by the given replacement patterns.\n\n**Example 6**\n\nGiven the following:\n\n```js\nvar arr = ['ABC', 'DEF'];\nvar replacements = {\n  'A': 'AAA',\n  'B': 'BBB',\n  'C': 'CCC',\n  'D': 'DDD',\n  'E': 'EEE',\n  'F': 'FFF'\n};\n\nreplace.arrWithObj(arr, replacements));\n// => ['AAABBBCCC', 'DDDEEEFFF']\n```\n\n## Usage example\n### replace.strWithArray( string, array )\n\n> Slugify URL segments using frep\n\nTo run the example, first do: `npm install frep underscore.string`\n\n```js\nvar replace = require('frep');\n\n// We'll use underscore string's slugify function for the first example\nvar _str = require('underscore.string');\n\n// A custom slugification function for the second\nvar slugger = function(str) {\n  return str.replace(/( |-|\\.)/g, '_').toLowerCase();\n};\n\n// And a third slugification function for the last example\nvar sluggifier = function(str) {\n  return str.replace(/( |\\.)/g, '-');\n};\n\n// This is an object of data, where each property will be used\n// to build up a URL that needs to be slugified.  e.g.\n// => /foo/bar/baz\n// (in reality, you would probably have an array of objects like this)\nvar obj = {\n  foo: 'This is foo.',\n  bar: 'ThIs iS bAr.',\n  baz: 'THIS is BAZ.',\n};\n\n// Our custom replacement patterns. These are used to\n// transform the data from each property\nvar patterns = [\n  {\n    pattern: /:foo/g,\n    replacement: _str.slugify(obj.foo) // underscore.string\n  },\n  {\n    pattern: /:bar/g,\n    replacement: slugger(obj.bar)  // custom function #1\n  },\n  {\n    pattern: /:baz/g,\n    replacement: sluggifier(obj.baz)  // custom function #2\n  }\n];\n\n// The first argument, a string, will be our \"structure\",\n// which will determine where the values from each property\n// will be placed. Run frep to see what happens!\nconsole.log(replace.strWithArr(':foo/:bar/:baz', patterns));\n```\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\nCopyright (c) 2014 Jon Schlinkert, contributors.\nReleased under the MIT license\n\n***\n\n_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on May 14, 2014._","_attachments":{},"homepage":"https://github.com/jonschlinkert/frep","bugs":{"url":"https://github.com/jonschlinkert/frep/issues"}}