Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
[![Build Status](https://travis-ci.org/functional-jslib/fjl-curry.png)](https://travis-ci.org/functional-jslib/fjl-curry) [![GitHub version](https://badge.fury.io/gh/functional-jslib%2Ffjl-curry.svg)](http://badge.fury.io/gh/functional-jslib%2Ffjl-curry)
curry
implementations; One for strict currying (based on function's length property) and
4 implementations for arbitrary currying up-to a user defined length; E.g.,
For default arity (strict) based currying:
import {curry} from 'fjl-curry';
const add$ = (a, b) => a + b;
add = curry(add$);
add(1)(1) === 2 // ...
For arbitrary currying:
import {curry2, curry3, curry4, curry5, curryN} from 'fjl-curry';
const add = (...args) => args.reduce((agg, arg) => agg + arg, 0),
add2 = curry2(add),
add3 = curry3(add),
add4 = curry4(add),
add5 = curry5(add),
add6 = curryN(6, add),
otherAdd2 = curryN(2, add); // same as `add2`
add2(1)(2) === 3; // true
add3(1)(2)(3) === 6; // ...
add4(1)(2)(3)(4) === 10; // ...
add5(1)(2)(3)(4)(5) === 15; // ...
add6(1)(2)(3)(4)(5)(6) === 15; // ...
otherAdd2(1)(2) === 3; // true
Jsdocs: https://functional-jslib.github.io/fjl-curry/module-fjlCurry.html
import {curry...} from 'fjl-curry'
const {curry} = require('fjl-curry');
Note: The module is also exported to 'amd', 'iife', and 'umd' formats ( look inside of './dist' for the export you want (in this case).
import {curry} from 'fjl-curry';
const someOp = curry((options, initialValue) => {
// ...
}),
somePreparedOp = someOp(initialOptions);
// Get value of prepared op somewhere else...
somePreparedOp('some-initial-value'); // wallah! Uses initially set options!
yarn add fjl-curry
ornpm install fjl-curry
curry (fn, ...initialArgs) : Function
- Curries a function based on it's defined arity - *functions length property;
Note: Functions length property shows the number of defined parameters by default though the contained
length value doesn't count the rest params parameter; E.g., // Variadic part is not counted in arity
((x, ...rest) => {}).length === 1
Example usage:
// Another example
const add3 = (a, b, c) => a + b + c,
add3$ = curry(add3);
add3$(1)(2)(3) === 6 //
curryN (n, fn, ...initialArgs) : Function
- Curries a function up to n
number of parameters; E.g., will curry
the given function until n
number of arguments are received; E.g., const _add3 = (...args) => args.reduce((agg, arg) => agg + arg, 0),
add3 = curry(_add3),
add2 = add3(98),
add1 = add2(1);
add1(1) === 98 + 1 + 1 // true
curry2 (fn) : Function
- Curries function up-to 2 or more arguments.curry3 (fn) : Function
- Curries function up-to 3 or more arguments.curry4 (fn) : Function
- Curries function up-to 4 or more arguments.curry5 (fn) : Function
- Curries function up-to 5 or more arguments.yarn test
ornpm test
BSD
FAQs
[![Build Status](https://travis-ci.org/functional-jslib/fjl-curry.png)](https://travis-ci.org/functional-jslib/fjl-curry) [![GitHub version](https://badge.fury.io/gh/functional-jslib%2Ffjl-curry.svg)](http://badge.fury.io/gh/functional-jslib%2Ffjl-curry)
We found that fjl-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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.