klubok 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -1
- package/dist/index.d.ts +1900 -55
- package/package.json +4 -4
package/README.md
CHANGED
@@ -13,7 +13,9 @@ import { pure, eff, klubok } from 'klubok';
|
|
13
13
|
|
14
14
|
const catsBirthdays = klubok(
|
15
15
|
eff('cats', async ({ ids }: { ids: number[] }) => { /* fetch cats from DB */ }),
|
16
|
-
|
16
|
+
|
17
|
+
pure('catsOneYearOld', ({ cats }) => cats.map(cat => ({ ...cat, age: cat.age + 1 })),
|
18
|
+
|
17
19
|
eff('saved', async ({ catsOneYearOld }) => { /* save to DB */ })
|
18
20
|
)
|
19
21
|
|
@@ -23,6 +25,7 @@ catsBirthdays({ ids: [1, 2, 3] })
|
|
23
25
|
// in tests usage
|
24
26
|
catsBirthdays(
|
25
27
|
{ ids: [1, 2, 3] },
|
28
|
+
|
26
29
|
{
|
27
30
|
// DB response mock
|
28
31
|
cats: () => [
|
@@ -30,9 +33,14 @@ catsBirthdays(
|
|
30
33
|
{ name: 'Marfa', age: 7 }
|
31
34
|
]
|
32
35
|
},
|
36
|
+
|
33
37
|
// call only this functions
|
34
38
|
['catsOneYearOld']
|
39
|
+
|
35
40
|
) // Promise<{ ..., catsOneYearOld: [{ name: 'Barsik', age: 11 }, { name: 'Marfa', age: 8 }] }>
|
36
41
|
|
37
42
|
```
|
38
43
|
|
44
|
+
## See also
|
45
|
+
|
46
|
+
* [Klubok-Gleam](https://github.com/darky/klubok-gleam) - Gleam implementation of Klubok
|