{"_id":"spots","_rev":"110322","name":"spots","description":"Partial function argument binding with placeholders","dist-tags":{"latest":"0.5.0"},"maintainers":[{"name":"bahmutov","email":"gleb.bahmutov@gmail.com"}],"time":{"modified":"2021-06-03T10:41:50.000Z","created":"2014-11-19T04:10:13.414Z","0.5.0":"2015-04-14T14:48:56.491Z","0.4.0":"2015-01-11T20:19:57.858Z","0.3.0":"2014-11-19T14:19:01.536Z","0.2.1":"2014-11-19T13:21:27.002Z","0.2.0":"2014-11-19T13:20:28.865Z","0.1.0":"2014-11-19T05:59:44.221Z","0.0.0":"2014-11-19T04:10:13.414Z"},"users":{"scottfreecode":true},"author":{"name":"Gleb Bahmutov","email":"gleb.bahmutov@gmail.com"},"repository":{"type":"git","url":"git@github.com:bahmutov/spots.git"},"versions":{"0.5.0":{"name":"spots","description":"Partial function argument binding with placeholders","version":"0.5.0","author":{"name":"Gleb Bahmutov","email":"gleb.bahmutov@gmail.com"},"bugs":{"url":"https://github.com/bahmutov/spots/issues"},"contributors":[],"devDependencies":{"functional-pipeline":"0.2.4","grunt-clean-console":"0.2.0","grunt-contrib-jshint":"0.11.1","grunt-contrib-watch":"0.6.1","grunt-deps-ok":"0.7.1","grunt-jshint-solid":"0.1.0","grunt-mocha-test":"0.12.7","grunt-nice-package":"0.9.2","grunt-npm2bower-sync":"0.8.1","grunt-umd":"2.3.3","jshint-summary":"0.4.0","karma":"0.12.32","karma-coverage":"0.2.7","karma-mocha":"0.1.10","karma-nested-reporter":"0.1.3","karma-node2umd":"1.0.0","karma-phantomjs-launcher":"0.1.4","lazy-ass":"0.5.3","matchdep":"0.3.0","pre-git":"0.2.1"},"engines":{"node":">= 0.8.0"},"homepage":"https://github.com/bahmutov/spots","keywords":["functional","javascript","partial","application","binding","placeholder"],"license":"MIT","main":"index.js","pre-commit":["npm test","npm version"],"repository":{"type":"git","url":"git@github.com:bahmutov/spots.git"},"scripts":{"test":"grunt","browser":"node node_modules/karma/bin/karma start test/karma.conf.js"},"gitHead":"89d5e6a7fae42d259d42de09b6568a73fc6b00f1","_id":"spots@0.5.0","_shasum":"b7aa0f1ac389a5a6d57c21e98da1d53839405fe1","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"bahmutov","email":"gleb.bahmutov@gmail.com"},"maintainers":[{"name":"bahmutov","email":"gleb.bahmutov@gmail.com"}],"dist":{"shasum":"b7aa0f1ac389a5a6d57c21e98da1d53839405fe1","size":5942,"noattachment":false,"key":"/spots/-/spots-0.5.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/spots/download/spots-0.5.0.tgz"},"directories":{},"publish_time":1429022936491,"_cnpm_publish_time":1429022936491,"_hasShrinkwrap":false},"0.4.0":{"name":"spots","description":"Partial function argument binding with placeholders","version":"0.4.0","author":{"name":"Gleb Bahmutov","email":"gleb.bahmutov@gmail.com"},"bugs":{"url":"https://github.com/bahmutov/spots/issues"},"contributors":[],"devDependencies":{"functional-pipeline":"0.2.4","grunt-clean-console":"0.1.1","grunt-contrib-jshint":"0.10.0","grunt-contrib-watch":"0.6.1","grunt-deps-ok":"0.5.1","grunt-jshint-solid":"0.1.0","grunt-mocha-test":"0.12.4","grunt-nice-package":"0.9.2","grunt-npm2bower-sync":"0.6.0","grunt-umd":"2.2.1","jshint-summary":"0.4.0","karma":"0.12.31","karma-coverage":"0.2.7","karma-mocha":"0.1.10","karma-nested-reporter":"0.1.3","karma-node2umd":"1.0.0","karma-phantomjs-launcher":"0.1.4","lazy-ass":"0.5.3","matchdep":"0.3.0","pre-git":"0.1.1"},"engines":{"node":">= 0.8.0"},"homepage":"https://github.com/bahmutov/spots","keywords":["functional","javascript","partial","application","binding","placeholder"],"license":"MIT","main":"index.js","pre-commit":["npm test","npm version"],"repository":{"type":"git","url":"git@github.com:bahmutov/spots.git"},"scripts":{"test":"grunt","browser":"node node_modules/karma/bin/karma start test/karma.conf.js"},"gitHead":"a9c692257e650563c9cc7e9d9b9325930ba66db2","_id":"spots@0.4.0","_shasum":"01eec5efc143669d9d3a20e3eec8b8cbd9842df6","_from":".","_npmVersion":"2.1.16","_nodeVersion":"0.11.10","_npmUser":{"name":"bahmutov","email":"gleb.bahmutov@gmail.com"},"maintainers":[{"name":"bahmutov","email":"gleb.bahmutov@gmail.com"}],"dist":{"shasum":"01eec5efc143669d9d3a20e3eec8b8cbd9842df6","size":5623,"noattachment":false,"key":"/spots/-/spots-0.4.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/spots/download/spots-0.4.0.tgz"},"directories":{},"publish_time":1421007597858,"_cnpm_publish_time":1421007597858,"_hasShrinkwrap":false},"0.3.0":{"name":"spots","description":"Partial function argument binding with placeholders","version":"0.3.0","author":{"name":"Gleb Bahmutov","email":"gleb.bahmutov@gmail.com"},"bugs":{"url":"https://github.com/bahmutov/spots/issues"},"devDependencies":{"functional-pipeline":"0.2.4","grunt-contrib-jshint":"0.10.0","grunt-contrib-watch":"0.6.1","grunt-deps-ok":"0.3.0","grunt-jshint-solid":"0.1.0","grunt-mocha-test":"0.11.0","grunt-nice-package":"0.9.1","lazy-ass":"0.5.3","matchdep":"0.3.0","pre-git":"0.0.16"},"engines":{"node":">= 0.8.0"},"homepage":"https://github.com/bahmutov/spots","keywords":["functional","javascript","partial","application","binding","placeholder"],"license":"MIT","main":"index.js","pre-commit":"npm test","repository":{"type":"git","url":"git@github.com:bahmutov/spots.git"},"scripts":{"test":"grunt"},"_id":"spots@0.3.0","_shasum":"b569114dd32c508e220b9f6bac1d088cddf7e0d6","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"bahmutov","email":"gleb.bahmutov@gmail.com"},"maintainers":[{"name":"bahmutov","email":"gleb.bahmutov@gmail.com"}],"dist":{"shasum":"b569114dd32c508e220b9f6bac1d088cddf7e0d6","size":3941,"noattachment":false,"key":"/spots/-/spots-0.3.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/spots/download/spots-0.3.0.tgz"},"directories":{},"publish_time":1416406741536,"_cnpm_publish_time":1416406741536,"_hasShrinkwrap":false},"0.2.1":{"name":"spots","description":"Partial function argument binding with placeholders","version":"0.2.1","author":{"name":"Gleb Bahmutov","email":"gleb.bahmutov@gmail.com"},"bugs":{"url":"https://github.com/bahmutov/spots/issues"},"devDependencies":{"functional-pipeline":"0.2.4","grunt-contrib-jshint":"0.10.0","grunt-contrib-watch":"0.6.1","grunt-deps-ok":"0.3.0","grunt-jshint-solid":"0.1.0","grunt-mocha-test":"0.11.0","grunt-nice-package":"0.9.1","lazy-ass":"0.5.3","matchdep":"0.3.0","pre-git":"0.0.16"},"engines":{"node":">= 0.8.0"},"homepage":"https://github.com/bahmutov/spots","keywords":["functional","javascript","partial","application","binding","placeholder"],"license":"MIT","main":"index.js","pre-commit":"npm test","repository":{"type":"git","url":"git@github.com:bahmutov/spots.git"},"scripts":{"test":"grunt"},"_id":"spots@0.2.1","_shasum":"54b1d662419ba8344bc6b99f612ac3f6e40ef796","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"bahmutov","email":"gleb.bahmutov@gmail.com"},"maintainers":[{"name":"bahmutov","email":"gleb.bahmutov@gmail.com"}],"dist":{"shasum":"54b1d662419ba8344bc6b99f612ac3f6e40ef796","size":3894,"noattachment":false,"key":"/spots/-/spots-0.2.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/spots/download/spots-0.2.1.tgz"},"directories":{},"publish_time":1416403287002,"_cnpm_publish_time":1416403287002,"_hasShrinkwrap":false},"0.2.0":{"name":"spots","description":"Partial function argument binding with placeholders","version":"0.2.0","author":{"name":"Gleb Bahmutov","email":"gleb.bahmutov@gmail.com"},"bugs":{"url":"https://github.com/bahmutov/spots/issues"},"devDependencies":{"functional-pipeline":"0.2.4","grunt-contrib-jshint":"0.10.0","grunt-contrib-watch":"0.6.1","grunt-deps-ok":"0.3.0","grunt-jshint-solid":"0.1.0","grunt-mocha-test":"0.11.0","grunt-nice-package":"0.9.1","lazy-ass":"0.5.3","matchdep":"0.3.0","pre-git":"0.0.16"},"engines":{"node":">= 0.8.0"},"homepage":"https://github.com/bahmutov/spots","keywords":["functional","javascript","partial","application","binding","placeholder"],"license":"MIT","main":"index.js","pre-commit":"npm test","repository":{"type":"git","url":"git@github.com:bahmutov/spots.git"},"scripts":{"test":"grunt"},"_id":"spots@0.2.0","_shasum":"8386d10ea176e33eee439eb0bd3d018bd50eee5e","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"bahmutov","email":"gleb.bahmutov@gmail.com"},"maintainers":[{"name":"bahmutov","email":"gleb.bahmutov@gmail.com"}],"dist":{"shasum":"8386d10ea176e33eee439eb0bd3d018bd50eee5e","size":3838,"noattachment":false,"key":"/spots/-/spots-0.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/spots/download/spots-0.2.0.tgz"},"directories":{},"publish_time":1416403228865,"_cnpm_publish_time":1416403228865,"_hasShrinkwrap":false},"0.1.0":{"name":"spots","version":"0.1.0","description":"Partial function argument binding with placeholders","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git@github.com:bahmutov/spots.git"},"keywords":["functional","javascript","partial","application","binding","placeholder"],"author":{"name":"Gleb Bahmutov","email":"gleb.bahmutov@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/bahmutov/spots/issues"},"homepage":"https://github.com/bahmutov/spots","devDependencies":{"functional-pipeline":"0.2.4","lazy-ass":"0.5.3"},"_id":"spots@0.1.0","_shasum":"1ba9ac3dbbe67a904c0722b461c4cc6c33833ed2","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"bahmutov","email":"gleb.bahmutov@gmail.com"},"maintainers":[{"name":"bahmutov","email":"gleb.bahmutov@gmail.com"}],"dist":{"shasum":"1ba9ac3dbbe67a904c0722b461c4cc6c33833ed2","size":2750,"noattachment":false,"key":"/spots/-/spots-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/spots/download/spots-0.1.0.tgz"},"directories":{},"publish_time":1416376784221,"_cnpm_publish_time":1416376784221,"_hasShrinkwrap":false},"0.0.0":{"name":"spots","version":"0.0.0","description":"Partial function argument binding with placeholders","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git@github.com:bahmutov/spots.git"},"keywords":["functional","javascript","partial","application","binding","placeholder"],"author":{"name":"Gleb Bahmutov","email":"gleb.bahmutov@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/bahmutov/spots/issues"},"homepage":"https://github.com/bahmutov/spots","devDependencies":{"functional-pipeline":"0.2.4","lazy-ass":"0.5.3"},"_id":"spots@0.0.0","_shasum":"3b9ae680b39990963b91c9d3b51378f1aa9a77a1","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"bahmutov","email":"gleb.bahmutov@gmail.com"},"maintainers":[{"name":"bahmutov","email":"gleb.bahmutov@gmail.com"}],"dist":{"shasum":"3b9ae680b39990963b91c9d3b51378f1aa9a77a1","size":2622,"noattachment":false,"key":"/spots/-/spots-0.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/spots/download/spots-0.0.0.tgz"},"directories":{},"publish_time":1416370213414,"_cnpm_publish_time":1416370213414,"_hasShrinkwrap":false}},"readme":"# spots\n\n> Partial function argument binding with placeholders\n\n[![NPM][spots-icon] ][spots-url]\n\n[![Build status][spots-ci-image] ][spots-ci-url]\n[![dependencies][spots-dependencies-image] ][spots-dependencies-url]\n[![devdependencies][spots-devdependencies-image] ][spots-devdependencies-url]\n\n**spots** makes it simple to bind some arguments, leaving the rest free.\n\n```js\nvar S = require('spots');\nfunction sub(a, b) {\n  return a - b;\n}\n// use library itself as a placeholder\nvar minus1 = S(sub, S, 1);\n// minus1 = sub(_, 1) function\nminus1(9); // 8, same as sub(9, 1);\n```\n\nIt can apply more than 1 argument.\n\n```js\nfunction add4(a, b, c, d) { return a + b + c + d; }\nvar applyEven = S(add4, S, 1, S, 2);\napplyEven(-1, -2); // 0\n// equivalent to add4(-1, 1, -2, 2);\n```\n\nIt works very nice to solve [JavaScript Madness][madness] problem.\n\n```js\n['1', '2', '3'].map(S(parseInt, S, 10));\n// returns [1, 2, 3]\n```\n\nYou can use **spots** with [functional-pipeline][fp] to apply arguments *to the individual steps*.\n\n```js\nvar fp = require('functional-pipeline');\nfunction add(a, b) { return a + b; }\nfunction sub(a, b) { return a - b; }\nfp(\n  S(sub, 1, S),\n  S(add, S, 20)\n)(3); // 18\n// same as\n// add( sub(1, 3), 20 )\n```\n\nReal world example [chdir-promise index.js](https://github.com/bahmutov/chdir-promise/blob/master/index.js)\nwhere we use *spots* to pass argument to `Q.try` method.\n\nIf there is a context (like filling some arguments to a method), you can bind to the object after applying **spots**\n\n```js\nvar calc = {\n  name: 'calc',\n  add4: function (a, b, c, d) {\n    return this.name + ' ' + a + b + c + d;\n  }\n};\nvar add_2_4 = S(calc.add4, S, 2, S, 4).bind(calc);\nadd_2_4(1, 3); // calc 10\n```\n\nRelated: \n\n* [Point-free is not pointless](http://glebbahmutov.com/blog/point-free-programming-is-not-pointless/)\n* [Selective application](http://glebbahmutov.com/blog/selective-partial-application/)\n* [functional-pipeline][fp]\n* [heroin](https://github.com/bahmutov/heroin)\n\nAvailable on NPM and bower under name `spots`.\n\n### Small print\n\nAuthor: Gleb Bahmutov &copy; 2014\n\n* [@bahmutov](https://twitter.com/bahmutov)\n* [glebbahmutov.com](http://glebbahmutov.com)\n* [blog](http://glebbahmutov.com/blog)\n\nLicense: MIT - do anything with the code, but don't blame me if it does not work.\n\nSpread the word: tweet, star on github, etc.\n\nSupport: if you find any problems with this module, email / tweet /\n[open issue](https://github.com/bahmutov/spots/issues) on Github\n\n## MIT License\n\nCopyright (c) 2014 Gleb Bahmutov\n\nPermission is hereby granted, free of charge, to any person\nobtaining a copy of this software and associated documentation\nfiles (the \"Software\"), to deal in the Software without\nrestriction, including without limitation the rights to use,\ncopy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the\nSoftware is furnished to do so, subject to the following\nconditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\nOF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\nHOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\nWHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\nOTHER DEALINGS IN THE SOFTWARE.\n\n[spots-icon]: https://nodei.co/npm/spots.png?downloads=true\n[spots-url]: https://npmjs.org/package/spots\n[spots-ci-image]: https://travis-ci.org/bahmutov/spots.png?branch=master\n[spots-ci-url]: https://travis-ci.org/bahmutov/spots\n[spots-dependencies-image]: https://david-dm.org/bahmutov/spots.png\n[spots-dependencies-url]: https://david-dm.org/bahmutov/spots\n[spots-devdependencies-image]: https://david-dm.org/bahmutov/spots/dev-status.png\n[spots-devdependencies-url]: https://david-dm.org/bahmutov/spots#info=devDependencies\n\n[madness]: https://github.com/raganwald-deprecated/homoiconic/blob/master/2013/01/madness.md\n[fp]: https://github.com/bahmutov/functional-pipeline\n","_attachments":{},"homepage":"https://github.com/bahmutov/spots","bugs":{"url":"https://github.com/bahmutov/spots/issues"},"license":"MIT"}