
Security News
Nx npm Packages Compromised in Supply Chain Attack Weaponizing AI CLI Tools
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.
Supercharge your functions by giving them the ability to auto-curry.
Note: This library actually uses partial application internally and not currying. So, yes, the name is a misnomer. It is the result of my incorrect understanding of the concepts when I wrote the library. It is still perfectly usable and is used in production.
npm install auto-curry --save
In node
, you can just require('auto-curry')
.
In the browser, you can use build/auto-curry.min.js
require.js
, browserify
etcwindow.autoCurry
var cu = require('auto-curry');
var add = cu(function (a, b) {
return a + b;
});
var messWithThis = cu(function(v){
this.a.push(v);
return ++v;
});
var map = cu(function map(fn, list) {
var self = arguments[2] ? arguments[2] : this;
try {
return list.map(fn, self);
}
catch (e) {
return [].map.call(list, fn, self);
}
});
var x = {a: []};
console.log(map(add(1), [1, 2, 3])); //[2, 3, 4]
console.log(map(messWithThis, [1,2,3], x)); //[2, 3, 4]
console.log(x.a); //[1, 2, 3]
var cu = window.autoCurry; //using it off the global
var add = cu(function (a, b) {
return a + b;
});
var messWithThis = cu(function(v){
this.a.push(v);
return ++v;
});
var map = cu(function map(fn, list) {
console.log(arguments[2]);
var self = arguments[2] ? arguments[2] : this;
try {
return list.map(fn, self);
}
catch (e) {
return [].map.call(list, fn, self);
}
});
var x = {a: []};
console.log(map(add(1), [1, 2, 3])); //[2, 3, 4]
console.log(map(messWithThis, [1,2,3], x)); //[2, 3, 4]
console.log(x.a); //[1, 2, 3]
0.2.1
auto-curry
has an arity of one, the function itself is returned. Earlier this was only for zero arity functions.FAQs
Supercharge your functions by giving them the ability to auto-curry
We found that auto-curry demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.
Security News
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.
Security News
A clarification on our recent research investigating 60 malicious Ruby gems.