klubok 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +6 -2
- package/dist/index.d.ts +1845 -0
- 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,10 @@ 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
|
-
|