Comparing version 0.1.0 to 0.1.1
{ | ||
"name": "jducers", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "A js transducers-like implementation using generators", | ||
@@ -26,2 +26,2 @@ "main": "index.js", | ||
"homepage": "https://github.com/jfet97/jducers#readme" | ||
} | ||
} |
@@ -18,6 +18,6 @@ # jducers | ||
## utility | ||
A little fp utility library used by jducers and available for you with **pipe**, **compose** and **curry** | ||
A little fp utility library used by jducers and available for you with **pipe**, **compose**, **curry**, **partial** and **partialRight** | ||
```js | ||
import { pipe, compose, curry } from 'jducers/src/utility'; | ||
import { pipe, compose, curry, partial, partialRight } from 'jducers/src/utility'; | ||
``` | ||
@@ -43,3 +43,3 @@ | ||
import * as SJ from 'jducers/src/jducers/sync' | ||
import { pipe } from 'jducers/src/utility'; | ||
import { pipe, partialRight } from 'jducers/src/utility'; | ||
@@ -56,8 +56,10 @@ let array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]; | ||
const run = partialRight(SJ.run, array); | ||
let jducer = pipe(syncIsOddFilter, syncDoubleMap); | ||
let res = SJ.run(jducer, array); | ||
let res = run(jducer); | ||
console.log(res); // [2, 6, 10, 14, 18, 22, 26, 30, 34, 38] | ||
jducer = pipe(syncIsOddFilter, syncDoubleMap, syncSumReduce); | ||
res = SJ.run(jducer, array); | ||
res = run(jducer); | ||
console.log(res); // 200 | ||
@@ -85,3 +87,3 @@ ``` | ||
import * as AJ from 'jducers/src/jducers/async' | ||
import { pipe } from 'jducers/src/utility'; | ||
import { pipe, partialRight } from 'jducers/src/utility'; | ||
@@ -106,8 +108,10 @@ const asyncArray = { | ||
const run = partialRight(AJ.run, asyncArray); | ||
let jducer = pipe(asyncIsOddFilter, asyncDoubleMap); | ||
let res = AJ.run(jducer, asyncArray); | ||
let res = run(jducer); | ||
res.then(x => console.log(x)); // [2, 6, 10, 14, 18, 22, 26, 30, 34, 38] | ||
jducer = pipe(asyncIsOddFilter, asyncDoubleMap, asyncSumReduce); | ||
res = AJ.run(jducer, asyncArray); | ||
res = run(jducer);; | ||
res.then(x => console.log(x)); // 200 | ||
@@ -124,3 +128,3 @@ | ||
// 1 2 2 4 3 6 4 8 5 10 6 12 ... | ||
res = AJ.run(jducer, asyncArray); | ||
res = run(jducer); | ||
res.then(x => console.log(x)); // 420 | ||
@@ -127,0 +131,0 @@ |
@@ -21,2 +21,5 @@ const pipe = (...fns) => x => fns.reduce((v, f) => f(v), x); | ||
export { pipe, compose, curryForReduce, curry } | ||
const partial = (fn, ...preset) => (...later) => fn(...preset, ...later); | ||
const partialRight = (fn, ...preset) => (...later) => fn(...later, ...preset); | ||
export { pipe, compose, curryForReduce, curry, partial, partialRight } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10945
105
138