{"maintainers":[{"name":"anonymous","email":"m@moox.io"}],"keywords":["string","reduce","replacement","function","call","eval","interpret"],"dist-tags":{"latest":"1.0.3"},"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.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","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":"anonymous","email":"m@moox.io"},"maintainers":[{"name":"anonymous","email":"m@moox.io"}],"dist":{"shasum":"ea2af804322728dbaccbafd0c2d5aed91f5be497","tarball":"http://repository.ncinga.com/nexus/content/repositories/npm-js-registry/reduce-function-call/-/reduce-function-call-1.0.0.tgz","integrity":"sha512-U/fz14OlG3MTBHrGP9SMNQDWM1QJzQV6ndXFOMldK50gelb1BMvUtY51tdgz5B749WDPt5Y3T3lU5bU0HUIQAQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBrPs4tqxv9/qqq7yfpUKv7RhMQKO6dBvWmBnHY7E6LaAiEAxYWs6x91eqqmahDi3PGuQviGIuWtN7AFqJEhkYsU1t0="}]},"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":"anonymous","email":"m@moox.io"},"maintainers":[{"name":"anonymous","email":"m@moox.io"}],"dist":{"shasum":"fa02e126e695824263cab91d3a5b0fdc1dd27a9a","tarball":"http://repository.ncinga.com/nexus/content/repositories/npm-js-registry/reduce-function-call/-/reduce-function-call-1.0.1.tgz","integrity":"sha512-OKW9uy4c6gqgoPBYYLjVj6+RBq/C/jwx5kaFYXpOhMj3eJd2iV9+UQ6OVpMKGZjW+uzJQ8OXCCSmPraHsjaGyQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFDz96YMjXWpii0Hp9n2x6b7rqfcb6mw21nhEdhezvVzAiEAvvkhW2NmmSp5zZaUCP45qeWOeMiXWROuW0a7eA/EMYY="}]},"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":"anonymous","email":"m@moox.io"},"dist":{"shasum":"5a200bf92e0e37751752fe45b0ab330fd4b6be99","tarball":"http://repository.ncinga.com/nexus/content/repositories/npm-js-registry/reduce-function-call/-/reduce-function-call-1.0.2.tgz","integrity":"sha512-oDG9BTdyqrUcOeUafoT4LoUP13n6vDx2I6jx+yumkTlQQhvoxysJINKmmjZHGaV9cYg4zZdk2xXTnfBTBq+dKg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDJnPzoeE8feZYajHmb/ZnwW0f25xovZVL3Ka3ubf6amQIhAMWySqGTxd7di+V4PWqZ6Yr0xDLfVdFcFdoWnWy7d5jZ"}]},"maintainers":[{"name":"anonymous","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":{}},"1.0.3":{"name":"reduce-function-call","version":"1.0.3","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"},"dependencies":{"balanced-match":"^1.0.0"},"devDependencies":{"npmpub":"^4.1.0","tape":"^4.0.3"},"scripts":{"test":"tape test","release":"npmpub"},"gitHead":"c03d492117d90398d4deb8af207928a00921f6aa","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.3","_nodeVersion":"10.15.1","_npmVersion":"6.9.0","dist":{"integrity":"sha512-Hl/tuV2VDgWgCSEeWMLwxLZqX7OK59eU1guxXsRKTAyeYimivsKdtcV4fu3r710tpG5GmDKDhQ0HSZLExnNmyQ==","shasum":"60350f7fb252c0a67eb10fd4694d16909971300f","tarball":"http://repository.ncinga.com/nexus/content/repositories/npm-js-registry/reduce-function-call/-/reduce-function-call-1.0.3.tgz","fileCount":5,"unpackedSize":6140,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdedkcCRA9TVsSAnZWagAA834P+QCjZv/7dPR81u53rgM5\not/peBMLNHiQkghj8AXBPVwyZ4lQYvay3akffUlql845NEHa0pkDTt9/CSJJ\naB68V0fG8Vj81RwZ4Z8e56PRzJ0eEKBCDyVArv0mvq2mOUU9KGWK/kVzP3hr\nOvnKXiBzSX/gFMiSwLGY0iLjYWpywfkr5rT6n1bwNjEhcWmzeL0+L4s0bcRC\n4ogx+Kos4EE8RSMBh9nOBl9mkvUdRSlgKEJIEoSwr0sBuM4VN2bPZUado9OS\n2DA59XFm/Tl201jn7gkPo4RKOqfZChXa9RUtq+O+Ve8KLa6c2P+jS2NA2kPn\n77d/Y1zj2WWm7UQ0WG/sjcQJgyqVNeHvdVt56gqvyre2fmypJwpLhfd2t4Tx\niIiYYGDA7JwgkuTmF+Jqdh/74NYdTaPCeAM5zyxLcHyf7iWyl04mH1Sx6Jb7\nb6IHcPKFEZIx47gCoNorHycpyh5Lo8R+p+eLAK5prkiOIbBkSzreRjdDBEqW\n+58nd7s6pAXq20CUcuITbMktt3+vhwW9thTnTT2c/PPXBYcohBZ/2JRbf1/Y\nvDSh2JIujcaKVKFTcIsRngaWZ5pn/uiphmgOJDPIFWcob1JYyYWRFkjbnY/O\n0R/HuThY9aAeIvY4vu7Eeq8jaSYB84iOuNWrdIGQB0K6WyZpOHTis7S5djmS\nT6JA\r\n=aBBm\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBK5a9jqwpa6BwTLjLIMCrN7J0rxXR56ft8qgCIOvbcyAiAsTvFOt46IaLISf8YcyDY/3/EFaYrbOSo/n+DwqcK+2A=="}]},"maintainers":[{"name":"anonymous","email":"m@moox.io"}],"_npmUser":{"name":"anonymous","email":"npm@moox.io"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/reduce-function-call_1.0.3_1568266524023_0.9800908344236074"},"_hasShrinkwrap":false}},"name":"reduce-function-call","time":{"modified":"2022-06-26T09:54:46.945Z","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","1.0.3":"2019-09-12T05:35:24.165Z"},"readmeFilename":"README.md","homepage":"https://github.com/MoOx/reduce-function-call#readme"}