{"maintainers":[{"name":"moox","email":"m@moox.io"}],"keywords":["string","reduce","replacement","function","call","eval","interpret"],"dist-tags":{"latest":"1.0.2"},"author":{"name":"MoOx"},"description":"Reduce function calls in a string, using a callback","readme":"# reduce-function-call [![Build Status](https://travis-ci.org/MoOx/reduce-function-call.png)](https://travis-ci.org/MoOx/reduce-function-call)\n\n> Reduce function calls in a string, using a callback\n\n## Installation\n\n```bash\nnpm install reduce-function-call\n```\n\n## Usage\n\n```js\nvar reduceFunctionCall = require(\"reduce-function-call\")\n\nreduceFunctionCall(\"foo(1)\", \"foo\", function(body) {\n  // body === \"1\"\n  return parseInt(body, 10) + 1\n})\n// \"2\"\n\nvar nothingOrUpper = function(body, functionIdentifier) {\n  // ignore empty value\n  if (body === \"\") {\n    return functionIdentifier + \"()\"\n  }\n\n  return body.toUpperCase()\n}\n\nreduceFunctionCall(\"bar()\", \"bar\", nothingOrUpper)\n// \"bar()\"\n\nreduceFunctionCall(\"upper(baz)\", \"upper\", nothingOrUpper)\n// \"BAZ\"\n\nreduceFunctionCall(\"math(math(2 + 2) * 4 + math(2 + 2)) and other things\", \"math\", function(body, functionIdentifier, call) {\n  try {\n    return eval(body)\n  }\n  catch (e) {\n    return call\n  }\n})\n// \"20 and other things\"\n\nreduceFunctionCall(\"sha bla blah() blaa bla() abla() aabla() blaaa()\", /\\b([a-z]?bla[a-z]?)\\(/, function(body, functionIdentifier) {\n  if (functionIdentifier === \"bla\") {\n    return \"ABRACADABRA\"\n  }\n  return functionIdentifier.replace(\"bla\", \"!\")\n}\n// \"sha bla !h blaa ABRACADABRA a! aabla() blaaa()\"\n```\n\nSee [unit tests](test/index.js) for others examples.\n\n## Contributing\n\nWork on a branch, install dev-dependencies, respect coding style & run tests before submitting a bug fix or a feature.\n\n```bash\ngit clone https://github.com/MoOx/reduce-function-call.git\ngit checkout -b patch-1\nnpm install\nnpm test\n```\n\n## [Changelog](CHANGELOG.md)\n\n## [License](LICENSE-MIT)\n","repository":{"type":"git","url":"git+https://github.com/MoOx/reduce-function-call.git"},"bugs":{"url":"https://github.com/MoOx/reduce-function-call/issues"},"license":"MIT","versions":{"1.0.0":{"name":"reduce-function-call","version":"1.0.0","description":"Reduce function calls in a string, using a callback","keywords":["string","reduce","replacement","function","call","eval","interpret"],"author":{"name":"MoOx"},"license":"MIT","repository":{"type":"git","url":"https://github.com/MoOx/reduce-function-call.git"},"files":["CHANGELOG.md","LICENSE","README.md","index.js"],"dependencies":{"balanced-match":"~0.1.0"},"devDependencies":{"jscs":"^1.5.9","jshint":"^2.5.2","jshint-stylish":"^0.4.0","tap-colorize":"^1.2.0","tape":"^2.13.4"},"scripts":{"jscs":"jscs *.js **/*.js","jshint":"jshint . --exclude node_modules --reporter node_modules/jshint-stylish/stylish.js","test":"npm run jscs && npm run jshint && tape test | tap-colorize"},"gitHead":"395cae7c72d76dddf4e8573d4e6c4fd25dfc1c4a","bugs":{"url":"https://github.com/MoOx/reduce-function-call/issues"},"homepage":"https://github.com/MoOx/reduce-function-call","_id":"reduce-function-call@1.0.0","_shasum":"ea2af804322728dbaccbafd0c2d5aed91f5be497","_from":".","_npmVersion":"1.5.0-alpha-1","_npmUser":{"name":"moox","email":"m@moox.io"},"maintainers":[{"name":"moox","email":"m@moox.io"}],"dist":{"shasum":"ea2af804322728dbaccbafd0c2d5aed91f5be497","tarball":"http://nexus.dui88.com:8081/nexus/content/groups/npm-all/reduce-function-call/-/reduce-function-call-1.0.0.tgz"},"directories":{}},"1.0.1":{"name":"reduce-function-call","version":"1.0.1","description":"Reduce function calls in a string, using a callback","keywords":["string","reduce","replacement","function","call","eval","interpret"],"author":{"name":"MoOx"},"license":"MIT","repository":{"type":"git","url":"https://github.com/MoOx/reduce-function-call.git"},"files":["CHANGELOG.md","LICENSE","README.md","index.js"],"dependencies":{"balanced-match":"~0.1.0"},"devDependencies":{"jscs":"^1.5.9","jshint":"^2.5.2","jshint-stylish":"^0.4.0","tap-colorize":"^1.2.0","tape":"^2.13.4"},"scripts":{"jscs":"jscs *.js **/*.js","jshint":"jshint . --exclude node_modules --reporter node_modules/jshint-stylish/stylish.js","test":"npm run jscs && npm run jshint && tape test | tap-colorize"},"gitHead":"eae61552a3ad386e221cb0315b6ac755393c5183","bugs":{"url":"https://github.com/MoOx/reduce-function-call/issues"},"homepage":"https://github.com/MoOx/reduce-function-call","_id":"reduce-function-call@1.0.1","_shasum":"fa02e126e695824263cab91d3a5b0fdc1dd27a9a","_from":".","_npmVersion":"1.5.0-alpha-1","_npmUser":{"name":"moox","email":"m@moox.io"},"maintainers":[{"name":"moox","email":"m@moox.io"}],"dist":{"shasum":"fa02e126e695824263cab91d3a5b0fdc1dd27a9a","tarball":"http://nexus.dui88.com:8081/nexus/content/groups/npm-all/reduce-function-call/-/reduce-function-call-1.0.1.tgz"},"directories":{}},"1.0.2":{"name":"reduce-function-call","version":"1.0.2","description":"Reduce function calls in a string, using a callback","keywords":["string","reduce","replacement","function","call","eval","interpret"],"author":{"name":"MoOx"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/MoOx/reduce-function-call.git"},"files":["CHANGELOG.md","LICENSE","README.md","index.js"],"dependencies":{"balanced-match":"^0.4.2"},"devDependencies":{"jscs":"^2.0.0","jshint":"^2.8.0","jshint-stylish":"^2.0.1","npmpub":"^3.1.0","tap-colorize":"^1.2.0","tape":"^4.0.3"},"scripts":{"jscs":"jscs *.js **/*.js","jshint":"jshint . --exclude node_modules --reporter node_modules/jshint-stylish/index.js","test":"npm run jscs && npm run jshint && tape test | tap-colorize","release":"npmpub"},"gitHead":"0e5721cbbef019419abb593dce4862794cad4872","bugs":{"url":"https://github.com/MoOx/reduce-function-call/issues"},"homepage":"https://github.com/MoOx/reduce-function-call#readme","_id":"reduce-function-call@1.0.2","_shasum":"5a200bf92e0e37751752fe45b0ab330fd4b6be99","_from":".","_npmVersion":"3.10.8","_nodeVersion":"6.9.1","_npmUser":{"name":"moox","email":"m@moox.io"},"dist":{"shasum":"5a200bf92e0e37751752fe45b0ab330fd4b6be99","tarball":"http://nexus.dui88.com:8081/nexus/content/groups/npm-all/reduce-function-call/-/reduce-function-call-1.0.2.tgz"},"maintainers":[{"name":"moox","email":"m@moox.io"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/reduce-function-call-1.0.2.tgz_1480317784283_0.19223617459647357"},"directories":{}}},"name":"reduce-function-call","time":{"modified":"2016-11-28T07:23:06.276Z","created":"2014-08-06T05:19:25.510Z","1.0.0":"2014-08-06T05:19:25.510Z","1.0.1":"2014-08-06T07:00:48.107Z","1.0.2":"2016-11-28T07:23:06.276Z"},"readmeFilename":"README.md","homepage":"https://github.com/MoOx/reduce-function-call#readme"}