Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@teleology/fp

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@teleology/fp - npm Package Compare versions

Comparing version 2.0.1 to 2.0.2

18

lib/curry.js

@@ -8,13 +8,13 @@ "use strict";

const curry = fn => (...args) => fn.bind(null, ...args); // export const curry = (arity = 0, fn) => (...args) => {
// // we have surpassed the expected arity, so invoke the final function
// if (arity <= args.length) {
// return fn(...args);
// }
// // we still have args we can bind, recurse
// const bound = fn.bind(fn, ...args);
// return curry(arity - args.length, bound);
// };
const curry = (arity = 0, fn) => (...args) => {
// we have surpassed the expected arity, so invoke the final function
if (arity <= args.length) {
return fn(...args);
} // we still have args we can bind, recurse
const bound = fn.bind(fn, ...args);
return curry(arity - args.length, bound);
};
exports.curry = curry;
{
"name": "@teleology/fp",
"version": "2.0.1",
"version": "2.0.2",
"description": "A small collection of functional programming utils",

@@ -5,0 +5,0 @@ "author": "Chris Sullivan <chrissullivan.dev@gmail.com>",

@@ -147,3 +147,21 @@ # @teleology/fp

## curry
Curry a specific function with a known [arity](https://en.wikipedia.org/wiki/Arity). Please note, optional arguments are not considered during invocation unless they are explicity set.
Example:
```javascript
const { curry } = require('@teleology/fp');
const test = (a, b, c) => console.log([a, b, c]);
const curried = curry(3, test);
// allows for flexibility
curried(1, 2, 3); // [1, 2, 3]
curried(1)(2)(3); // [1, 2, 3]
curried(1)(2, 3); // [1, 2, 3]
curried(1, 2)(3); // [1, 2, 3]
```
## filter

@@ -313,2 +331,5 @@

**2.0.2**
- Added `curry` function
**2.0.0**

@@ -315,0 +336,0 @@ - Changed how `pick` operates, to migrate use `get` which is now exposed

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc