motion
Version:
motion - moving development forward
78 lines (77 loc) • 4.09 kB
JSON
{
"_args": [
[
"reduce-function-call@https://registry.npmjs.org/reduce-function-call/-/reduce-function-call-1.0.1.tgz",
"/Users/nw/flint/packages/flint"
]
],
"_from": "reduce-function-call@>=1.0.1 <2.0.0",
"_id": "reduce-function-call@1.0.1",
"_inCache": true,
"_location": "/reduce-function-call",
"_phantomChildren": {},
"_requested": {
"name": "reduce-function-call",
"raw": "reduce-function-call@https://registry.npmjs.org/reduce-function-call/-/reduce-function-call-1.0.1.tgz",
"rawSpec": "https://registry.npmjs.org/reduce-function-call/-/reduce-function-call-1.0.1.tgz",
"scope": null,
"spec": "https://registry.npmjs.org/reduce-function-call/-/reduce-function-call-1.0.1.tgz",
"type": "remote"
},
"_requiredBy": [
"/reduce-css-calc"
],
"_resolved": "https://registry.npmjs.org/reduce-function-call/-/reduce-function-call-1.0.1.tgz",
"_shasum": "fa02e126e695824263cab91d3a5b0fdc1dd27a9a",
"_shrinkwrap": null,
"_spec": "reduce-function-call@https://registry.npmjs.org/reduce-function-call/-/reduce-function-call-1.0.1.tgz",
"_where": "/Users/nw/flint/packages/flint",
"author": {
"name": "MoOx"
},
"bugs": {
"url": "https://github.com/MoOx/reduce-function-call/issues"
},
"dependencies": {
"balanced-match": "~0.1.0"
},
"description": "Reduce function calls in a string, using a callback",
"devDependencies": {
"jscs": "^1.5.9",
"jshint": "^2.5.2",
"jshint-stylish": "^0.4.0",
"tap-colorize": "^1.2.0",
"tape": "^2.13.4"
},
"files": [
"CHANGELOG.md",
"LICENSE",
"README.md",
"index.js"
],
"homepage": "https://github.com/MoOx/reduce-function-call#readme",
"keywords": [
"call",
"eval",
"function",
"interpret",
"reduce",
"replacement",
"string"
],
"license": "MIT",
"name": "reduce-function-call",
"optionalDependencies": {},
"readme": "# reduce-function-call [](https://travis-ci.org/MoOx/reduce-function-call)\n\nReduce 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",
"readmeFilename": "README.md",
"repository": {
"type": "git",
"url": "git+https://github.com/MoOx/reduce-function-call.git"
},
"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"
},
"version": "1.0.1"
}