{"_id":"curry","_rev":"51-4d108329bb64fcf9a2b29d12c6872b4a","name":"curry","dist-tags":{"latest":"1.2.0"},"versions":{"0.0.0":{"name":"curry","version":"0.0.0","author":{"name":"Dominic Tarr","email":"dominic.tarr@gmail.com"},"_id":"curry@0.0.0","homepage":"https://github.com/dominictarr/curry","dist":{"shasum":"a1dab8304e926a5bf262e54aebec35c1c94357a8","tarball":"https://registry.npmjs.org/curry/-/curry-0.0.0.tgz","integrity":"sha512-5Jxh/emmvfu2dcswlEK5bn1aFA5fkUklZ5xucO9rAYHggamTqi0qx2yG8wOBdoYFVwDnziucFim5acpTmtDTVA==","signatures":[{"sig":"MEUCIQCGOm5jYmo96KwQKvTgKiet8GWHm5ldC7qtv2VjYqGxQQIgYJqS6gy+mPUY8F9RCLuKgbRF45v0S7txF9Lp9PD94Eo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"./curry","files":[""],"engines":{"node":"*"},"scripts":{"test":"expresso test/curry.expresso.js"},"repository":"git://github.com/dominictarr/curry.git","_npmVersion":"0.2.17","description":"flexible but simple curry function","directories":{},"_nodeVersion":"v0.3.0","_defaultsLoaded":true,"devDependencies":{"should":"0.0.x","expresso":">=0.6.0"},"_engineSupported":true},"0.0.1":{"name":"curry","version":"0.0.1","author":{"name":"Dominic Tarr","email":"dominic.tarr@gmail.com"},"_id":"curry@0.0.1","homepage":"https://github.com/dominictarr/curry","dist":{"shasum":"590e4c486475da3ecca7f676796fb688f1363ac5","tarball":"https://registry.npmjs.org/curry/-/curry-0.0.1.tgz","integrity":"sha512-goDTvZha6B14LeuRy4NJgBaJa75Gi3EcOfttZpNH7ehPlK2/pWzm+9BzlYmm3z4+QLkV5i1gZA5/aut5miRYyg==","signatures":[{"sig":"MEYCIQDFUxyYNuTbsW+GCp2AgLY7zdyLtH5R/6zNwUmXZtGQ/gIhANEj90Ukr5y3uw0GmwxEZbK3a5erhWkzxWKM+K36/i4i","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"./curry","files":[""],"engines":{"node":"*"},"scripts":{"test":"expresso test/curry.expresso.js"},"repository":{"url":"git://github.com/dominictarr/curry.git","type":"git"},"_npmVersion":"0.3.12","description":"flexible but simple curry function","directories":{},"_nodeVersion":"v0.4.1","_defaultsLoaded":true,"devDependencies":{"should":"0.0.x","expresso":">=0.6.0"},"_engineSupported":true},"0.0.2":{"name":"curry","version":"0.0.2","author":{"name":"Dominic Tarr","email":"dominic.tarr@gmail.com"},"_id":"curry@0.0.2","homepage":"https://github.com/dominictarr/curry","dist":{"shasum":"ffda336c4011a2e7cb8c90bca6fa85fe6111810f","tarball":"https://registry.npmjs.org/curry/-/curry-0.0.2.tgz","integrity":"sha512-rurIiB8EkoXj11cDmz25dAy83ss6+Rt8vMFgVYgD2fCZJzMtbT29KPo4N/P9100rnPlG5t0ln8K9UoWL3PfIFw==","signatures":[{"sig":"MEUCIHD1gABn8/CtwyhkAJwTJluE8vRyZwk8sJFzSg9EgJ4iAiEAyTpdptJUA4JG5o2GSpxSKZL5zldS9/WJ8eWHj7Lw32E=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"./curry","files":[""],"engines":{"node":"*"},"scripts":{"test":"expresso test/curry.expresso.js"},"repository":{"url":"git://github.com/dominictarr/curry.git","type":"git"},"_npmVersion":"0.3.12","description":"flexible but simple curry function - now compatible with firefox","directories":{},"_nodeVersion":"v0.4.2","_defaultsLoaded":true,"devDependencies":{"should":"0.0.x","expresso":">=0.6.0"},"_engineSupported":true},"0.0.3":{"name":"curry","version":"0.0.3","author":{"name":"Dominic Tarr","email":"dominic.tarr@gmail.com"},"_id":"curry@0.0.3","maintainers":[{"name":"dominictarr","email":"dominic.tarr@gmail.com"}],"homepage":"https://github.com/dominictarr/curry","dist":{"shasum":"da7c18390af7d624ca90e380c2146dbf7719847a","tarball":"https://registry.npmjs.org/curry/-/curry-0.0.3.tgz","integrity":"sha512-/LhM3IXHlYm1OHlfdDwR/18OCPmUbdJwEqxHG/jFNyWGcHx4lCLCZHWjCAsw32YTN37ymJYFD1OgItCPSODImw==","signatures":[{"sig":"MEYCIQC1+8HXmMWY3zlBKX+pkhHqRuPhhWl7jeOONUz5NfkcvAIhALHjps5q8ZVhFeQ4HVYuhVoYccDqxx68OupA3fpYB15B","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"./curry","engines":{"node":"*"},"scripts":{"test":"synct test/*.js"},"repository":{"url":"git://github.com/dominictarr/curry.git","type":"git"},"_npmVersion":"1.0.27","description":"flexible but simple curry function","directories":{},"_nodeVersion":"v0.4.10","_npmJsonOpts":{"file":"/home/dominic/.npm/curry/0.0.3/package/package.json","wscript":false,"serverjs":false,"contributors":false},"dependencies":{},"_defaultsLoaded":true,"devDependencies":{},"_engineSupported":true},"0.0.4":{"name":"curry","version":"0.0.4","author":{"name":"Dominic Tarr","email":"dominic.tarr@gmail.com"},"_id":"curry@0.0.4","maintainers":[{"name":"dominictarr","email":"dominic.tarr@gmail.com"}],"homepage":"https://github.com/dominictarr/curry","dist":{"shasum":"1750d518d919c44f3d37ff44edc693de1f0d5fcb","tarball":"https://registry.npmjs.org/curry/-/curry-0.0.4.tgz","integrity":"sha512-IPapCjuLQfb9u7HEU+l7XX10CmK5ojdvjt+0sNrZmSvSU31OZxPV78cmDj1Zm+ZX/tEh7jeYdaD4v89iJDOD0g==","signatures":[{"sig":"MEUCIEIWRxUxtTLtHIWDiagCJ5pWYS0J/mCuocLlwVCN85krAiEAlh/IfdupN/Jl92lKO4R61JDWeFd8vmGmtGfzjUugTx0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"./curry","engines":{"node":"*"},"scripts":{"test":"synct test/*.js"},"repository":{"url":"git://github.com/dominictarr/curry.git","type":"git"},"_npmVersion":"1.0.27","description":"flexible but simple curry function","directories":{},"_nodeVersion":"v0.4.10","_npmJsonOpts":{"file":"/home/dominic/.npm/curry/0.0.4/package/package.json","wscript":false,"serverjs":false,"contributors":false},"dependencies":{},"_defaultsLoaded":true,"devDependencies":{},"_engineSupported":true},"1.0.0":{"name":"curry","version":"1.0.0","author":{"name":"Dominic Tarr","email":"dominic.tarr@gmail.com"},"_id":"curry@1.0.0","maintainers":[{"name":"dominictarr","email":"dominic.tarr@gmail.com"},{"name":"hughfdjackson","email":"hughfdjackson@googlemail.com"}],"contributors":[{"name":"Hugh FD Jackson","email":"hughfdjackson@googlemail.com"}],"homepage":"https://github.com/dominictarr/curry","bugs":{"url":"https://github.com/dominictarr/curry/issues"},"dist":{"shasum":"642e3d134834219d363c0da516a0f764152b2064","tarball":"https://registry.npmjs.org/curry/-/curry-1.0.0.tgz","integrity":"sha512-gEKV3z7LYzThRHid/deFdtT5o68O6T8FUjElaRR3cBovxd8yDUUIYJNBvN7WGiloB93FXfCYrHLRCDa2Essd4Q==","signatures":[{"sig":"MEUCIQDQbWfu/JySiP+CbLVFFB1KXfLd0r+j0Ydy7l+uuCwO+AIgdmmh04QfiEGhJfk6iow2l8s5aXRzDI2P+Q7R6jeVNzw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"./curry","_from":".","scripts":{"test":"./node_modules/mocha/bin/mocha test"},"_npmUser":{"name":"hughfdjackson","email":"hughfdjackson@googlemail.com"},"testling":{"files":"test/*-test.js","harness":"mocha","browsers":["iexplore/6.0","iexplore/7.0","iexplore/8.0","iexplore/9.0","iexplore/10.0","chrome/4.0","chrome/23.0","firefox/3.0","firefox/17.0","safari/5.0.5","safari/5.1"]},"repository":{"url":"git://github.com/dominictarr/curry.git","type":"git"},"_npmVersion":"1.2.21","description":"flexible but simple curry function","directories":{},"devDependencies":{"mocha":"1.8.1"}},"1.0.2":{"name":"curry","version":"1.0.2","author":{"name":"Dominic Tarr","email":"dominic.tarr@gmail.com"},"_id":"curry@1.0.2","maintainers":[{"name":"dominictarr","email":"dominic.tarr@gmail.com"},{"name":"hughfdjackson","email":"hughfdjackson@googlemail.com"}],"contributors":[{"name":"Hugh FD Jackson","email":"hughfdjackson@googlemail.com"}],"homepage":"https://github.com/dominictarr/curry","bugs":{"url":"https://github.com/dominictarr/curry/issues"},"dist":{"shasum":"9a5cdf0d5898032bb99784ba0d95f8ccd1fa19f3","tarball":"https://registry.npmjs.org/curry/-/curry-1.0.2.tgz","integrity":"sha512-YC7QyuO+M3t9jshyhJVnTAhUTz4ZalASsD4cMkKJzbhirpFZDHAUKThd5fe7HwxoWQ5ZIWCmdS5jV3Os/kU59A==","signatures":[{"sig":"MEYCIQCXqGRsq96TkDyWg9As1wZ0pZCptFZ8ifNUeDDDcrLd/wIhAPauySjCfCHjiGFzjQmuJpOfWEQ3mmrl2NMb1jG8nz9I","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"./curry","_from":".","scripts":{"test":"./node_modules/mocha/bin/mocha test","prepublish":"./node_modules/browserify/bin/cmd.js --standalone curry -e curry.js | ./node_modules/uglify-js/bin/uglifyjs > curry.min.js"},"_npmUser":{"name":"hughfdjackson","email":"hughfdjackson@googlemail.com"},"testling":{"files":"test/*-test.js","harness":"mocha","browsers":["iexplore/6.0","iexplore/7.0","iexplore/8.0","iexplore/9.0","iexplore/10.0","chrome/4.0","chrome/23.0","firefox/3.0","firefox/17.0","safari/5.0.5","safari/5.1"]},"repository":{"url":"git://github.com/dominictarr/curry.git","type":"git"},"_npmVersion":"1.2.21","description":"flexible but simple curry function","directories":{},"devDependencies":{"mocha":"1.8.1","uglify-js":"2.3.6","browserify":"2.17.2"}},"1.1.0":{"name":"curry","version":"1.1.0","author":{"name":"Dominic Tarr","email":"dominic.tarr@gmail.com"},"_id":"curry@1.1.0","maintainers":[{"name":"dominictarr","email":"dominic.tarr@gmail.com"},{"name":"hughfdjackson","email":"hughfdjackson@googlemail.com"}],"contributors":[{"name":"Hugh FD Jackson","email":"hughfdjackson@googlemail.com"}],"homepage":"https://github.com/dominictarr/curry","bugs":{"url":"https://github.com/dominictarr/curry/issues"},"dist":{"shasum":"2a0afab90743180b4d5647d316e0b6d4e3c0a265","tarball":"https://registry.npmjs.org/curry/-/curry-1.1.0.tgz","integrity":"sha512-UvmwEXmhsHT7fTqoFc5dAJeA8hiprYdEe+TQC9TYA1YPbghWQrfjyCZlaxdCFQag19Kzw2bH7GgEDJ6quKDZwA==","signatures":[{"sig":"MEQCIHcamUqDbWrrcw+VGFRHSX21DWEyXguVJqls2pYT/gp7AiB25pVfCD0tUCw5p7DIkmNqHhbvg62FKqfW6BOFDSogrg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"./curry","_from":".","scripts":{"test":"./node_modules/mocha/bin/mocha test","prepublish":"./node_modules/browserify/bin/cmd.js --standalone curry -e curry.js | ./node_modules/uglify-js/bin/uglifyjs > curry.min.js"},"_npmUser":{"name":"hughfdjackson","email":"hughfdjackson@googlemail.com"},"testling":{"files":"test/*-test.js","harness":"mocha","browsers":["iexplore/6.0","iexplore/7.0","iexplore/8.0","iexplore/9.0","iexplore/10.0","chrome/4.0","chrome/23.0","firefox/3.0","firefox/17.0","safari/5.0.5","safari/5.1"]},"repository":{"url":"git://github.com/dominictarr/curry.git","type":"git"},"_npmVersion":"1.2.21","description":"flexible but simple curry function","directories":{},"devDependencies":{"mocha":"1.8.1","uglify-js":"2.3.6","browserify":"2.17.2"}},"1.2.0":{"name":"curry","version":"1.2.0","author":{"name":"Dominic Tarr","email":"dominic.tarr@gmail.com"},"_id":"curry@1.2.0","maintainers":[{"name":"dominictarr","email":"dominic.tarr@gmail.com"},{"name":"hughfdjackson","email":"hughfdjackson@googlemail.com"}],"contributors":[{"name":"Hugh FD Jackson","email":"hughfdjackson@googlemail.com"}],"homepage":"https://github.com/dominictarr/curry","bugs":{"url":"https://github.com/dominictarr/curry/issues"},"dist":{"shasum":"9e6dd289548dba7e653d5ae3fe903fe7dfb33af2","tarball":"https://registry.npmjs.org/curry/-/curry-1.2.0.tgz","integrity":"sha512-PAdmqPH2DUYTCc/aknv6RxRxmqdRHclvbz+wP8t1Xpg2Nu13qg+oLb6/5iFoDmf4dbmC9loYoy9PwwGbFt/AqA==","signatures":[{"sig":"MEUCIG/kXyG9yNnwrF9uzjSPKBDMNR0EsXiG7mi2sCdcVzb6AiEAgqwvZONdbgZKpFAX0cNYVBLvZQztWTlThApPVoGQtbI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"./curry","_from":".","scripts":{"test":"./node_modules/mocha/bin/mocha test","prepublish":"./node_modules/browserify/bin/cmd.js --standalone curry -e curry.js | ./node_modules/uglify-js/bin/uglifyjs > curry.min.js"},"_npmUser":{"name":"hughfdjackson","email":"hughfdjackson@googlemail.com"},"testling":{"files":"test/*-test.js","harness":"mocha","browsers":["iexplore/6.0","iexplore/7.0","iexplore/8.0","iexplore/9.0","iexplore/10.0","chrome/4.0","chrome/23.0","firefox/3.0","firefox/17.0","safari/5.0.5","safari/5.1"]},"repository":{"url":"git://github.com/dominictarr/curry.git","type":"git"},"_npmVersion":"1.2.21","description":"flexible but simple curry function","directories":{},"devDependencies":{"delve":"0.3.2","mocha":"1.8.1","lodash":"2.1.0","uglify-js":"2.3.6","browserify":"2.17.2"}}},"time":{"created":"2011-02-07T10:07:57.039Z","modified":"2025-09-09T12:52:52.474Z","0.0.0":"2011-02-07T10:07:58.632Z","0.0.1":"2011-03-03T05:51:14.360Z","0.0.2":"2011-03-23T10:40:12.040Z","0.0.3":"2011-09-07T23:52:24.367Z","0.0.4":"2011-09-14T14:52:44.612Z","1.0.0":"2013-07-04T23:46:25.110Z","1.0.2":"2013-07-08T00:28:31.356Z","1.1.0":"2013-09-18T20:09:58.244Z","1.2.0":"2013-09-27T23:18:36.022Z"},"bugs":{"url":"https://github.com/dominictarr/curry/issues"},"author":{"name":"Dominic Tarr","email":"dominic.tarr@gmail.com"},"homepage":"https://github.com/dominictarr/curry","repository":{"url":"git://github.com/dominictarr/curry.git","type":"git"},"description":"flexible but simple curry function","contributors":[{"name":"Hugh FD Jackson","email":"hughfdjackson@googlemail.com"}],"maintainers":[{"name":"hughfdjackson","email":"hughfdjackson@googlemail.com"}],"readme":"CURRY\n=====\n\nA curry function without anything **too clever**\n_(... because hunger is the finest spice)_\n\n[![browser support](https://ci.testling.com/hughfdjackson/curry.png)](https://ci.testling.com/hughfdjackson/curry)\n\n\n# Why\n\nIf you don't know currying, or aren't sold on it's awesomeness, perhaps [a friendly blog post](http://hughfdjackson.com/javascript/2013/07/06/why-curry-helps/) will help.\n\n\n# API\n\n### curry\n\n```javascript\nvar curry = require('curry');\n\n//-- creating a curried function is pretty\n//-- straight forward:\nvar add = curry(function(a, b){ return a + b });\n\n//-- it can be called like normal:\nadd(1, 2) //= 3\n\n//-- or, if you miss off any arguments,\n//-- a new funtion that expects all (or some) of\n//-- the remaining arguments will be created:\nvar add1 = add(1);\nadd1(2) //= 3;\n\n//-- curry knows how many arguments a function should take\n//-- by the number of parameters in the parameter list\n\n//-- in this case, a function and two arrays is expected\n//-- (fn, a, b).  zipWith will combine two arrays using a function:\nvar zipWith = curry(function(fn, a, b){\n    return a.map(function(val, i){ return fn(val, b[i]) });\n});\n\n//-- if there are still more arguments required, a curried function\n//-- will always return a new curried function:\nvar zipAdd = zipWith(add);\nvar zipAddWith123 = zipAdd([1, 2, 3]);\n\n//-- both functions are usable as you'd expect at any time:\nzipAdd([1, 2, 3], [1, 2, 3]); //= [2, 4, 6]\nzipAddWith123([5, 6, 7]); //= [6, 8, 10]\n\n//-- the number of arguments a function is expected to provide\n//-- can be discovered by the .length property\nzipWith.length; //= 3\nzipAdd.length; //= 2\nzipAddWith123.length; //= 1\n```\n\n### curry.to\n\nSometimes it's necessary (especially when wrapping variadic functions) to explicitly provide an arity for your curried function:\n\n```javascript\nvar sum = function(){\n\tvar nums = [].slice.call(arguments);\n\treturn nums.reduce(function(a, b){ return a + b });\n}\n\nvar sum3 = curry.to(3, sum);\nvar sum4 = curry.to(4, sum);\n\nsum3(1, 2)(3) //= 6\nsum4(1)(2)(3, 4) //= 10\n```\n\n### curry.adapt\n\nIt's a (sad?) fact that JavaScript functions are often written to take the 'context' object as the first argument.\n\nWith curried functions, of course, we want it to be the last object.  `curry.adapt` shifts the context to the last argument,\nto give us a hand with this:\n\n```javascript\nvar delve = require('delve');\nvar delveC = curry.adapt(delve);\n\nvar getDataFromResponse = delveC('response.body.data');\ngetDataFromResponse({ response: { body: { data: { x: 2 }} } }); //= { x: 2 }\n```\n\n### curry.adaptTo\n\nLike `curry.adapt`, but the arity explicitly provided:\n\n```javascript\nvar _ = require('lodash');\nvar map = curry.adaptTo(2, _.map);\nvar mapInc = map(function(a){ return a + 1 })\n\nmapInc([1, 2, 3]) //= [2, 3, 4]\n```\n\n# installation\n\n### node/npm\n\n```bash\nnpm install curry\n```\n\n### amd\n\n```javascript\ndefine(['libs/curry.min'], function(curry){\n    //-- assuming libs/curry.min.js is the downloaded minified version from this repo,\n    //-- curry will be available here\n});\n```\n\n### browser\n\nIf you're not using tools like [browserify](https://github.com/substack/node-browserify) or [require.js](http://requirejs.org), you can load curry globally:\n```html\n<script src=\"libs/curry.min.js\"></script>\n<script>\n    <!-- curry available here -->\n</script>\n```\n∏∏\n","readmeFilename":"README.md","users":{"akiva":true,"sylti":true,"axelav":true,"monjer":true,"nichoth":true,"popc0rn":true,"vidhill":true,"wenbing":true,"awaterma":true,"nukisman":true,"shawnbot":true,"reeywhaar":true,"princetoad":true,"trapcodien":true,"esperluette":true,"josealmeida":true,"guidoschmidt":true,"nickeltobias":true,"tobiasnickel":true,"scottfreecode":true}}