https://github.com/bda-research/ffuncs
https://github.com/bda-research/ffuncs
Last synced: 10 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/bda-research/ffuncs
- Owner: bda-research
- Created: 2019-05-07T05:41:31.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-12-30T18:17:09.000Z (about 3 years ago)
- Last Synced: 2025-02-28T07:19:05.551Z (10 months ago)
- Language: JavaScript
- Size: 76.2 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ffuncs
A small functional library for JavaScript which is an enhancement of ramda.
## Contents
```javascript
const ff = require("ffuncs");
ff.curry; // a function that curries the given function.
// uses the `length` property of a function,
// so functions using the `...` operator
// may provide unexpected behaviour when
// curried
let add = (x, y) => x + y;
let addFive = ff.curry(add)(5);
console.log([1, 2, 3, 4]).map(addFive); // [6, 7, 8, 9]
ff.vectorize; // this takes a unary (single-arg) or
// binary (double-arg) function as input
// and applies it over arrays.
let vadd = ff.vectorize(add);
console.log(vadd(2, 5)); // 7
console.log(vadd(5, [1, 2, 3, 4])); // [6, 7, 8, 9]
console.log(vadd([1, 2], [3, 4])); // [4, 6]
ff.memoize; // memoizes a numeric function.
// ...
// you know what this is
ff.integrate(global);
// now you can use the functions within the global scope
curry(add)(3)(7) == 10;
// etc.
```