{"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://registry-npm.ywwl.com/reduce-function-call/download/reduce-function-call-1.0.0.tgz","integrity":"sha512-U/fz14OlG3MTBHrGP9SMNQDWM1QJzQV6ndXFOMldK50gelb1BMvUtY51tdgz5B749WDPt5Y3T3lU5bU0HUIQAQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBrPs4tqxv9/qqq7yfpUKv7RhMQKO6dBvWmBnHY7E6LaAiEAxYWs6x91eqqmahDi3PGuQviGIuWtN7AFqJEhkYsU1t0="}],"size":2652,"noattachment":false,"key":"/reduce-function-call/-/reduce-function-call-1.0.0.tgz"},"directories":{},"readme":"# reduce-function-call [![Build Status](https://travis-ci.org/MoOx/reduce-function-call.svg?branch=master)](https://travis-ci.org/MoOx/reduce-function-call)\n\n> Reduce function calls in a string, using a callback\n\n---\n\n[Professionally supported reduce-function-call is now available](https://tidelift.com/subscription/pkg/npm-reduce-function-call?utm_source=npm-reduce-function-call&utm_medium=referral&utm_campaign=readme)\n\n---\n\n## Installation\n\n```console\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```console\ngit clone https://github.com/MoOx/reduce-function-call.git\ngit checkout -b patch-1\nnpm install\nnpm test\n```\n\n---\n\n## [Changelog](CHANGELOG.md)\n\n## [License](LICENSE)\n\n---\n\n## Security contact information\n\nTo report a security vulnerability, please use the\n[Tidelift security contact](https://tidelift.com/security). Tidelift will\ncoordinate the fix and disclosure.\n\n","publish_time":1407302365510,"_cnpm_publish_time":1407302365510,"dist-tags":{"latest":"1.0.3"}}