@zemnmez/future 1.0.2 → 1.0.3
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 -13
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -73,21 +73,21 @@ const message = future(
|
|
|
73
73
|
```
|
|
74
74
|
|
|
75
75
|
`future_and_then` maps a resolved value while preserving the loading and error
|
|
76
|
-
types. `
|
|
77
|
-
combines several Futures into one.
|
|
76
|
+
types. `future_coincide_then` chains a Future-returning operation, and
|
|
77
|
+
`future_collect` combines several Futures into one.
|
|
78
78
|
|
|
79
79
|
## Pipelines
|
|
80
80
|
|
|
81
|
-
`
|
|
82
|
-
|
|
83
|
-
|
|
81
|
+
`future_coincide_then` composes Future-returning operations into a pipeline.
|
|
82
|
+
Each operation receives the preceding resolved value, while a loading or error
|
|
83
|
+
state stops the pipeline. The resulting Future includes the loading and error
|
|
84
|
+
types from every operation:
|
|
84
85
|
|
|
85
86
|
```typescript
|
|
86
87
|
import {
|
|
87
88
|
error,
|
|
88
89
|
Future,
|
|
89
|
-
|
|
90
|
-
future_flatten_then,
|
|
90
|
+
future_coincide_then,
|
|
91
91
|
resolve,
|
|
92
92
|
} from '@zemnmez/future';
|
|
93
93
|
|
|
@@ -108,12 +108,8 @@ const displayName = (
|
|
|
108
108
|
): Future<string, 'formatting name', 'missing name'> =>
|
|
109
109
|
user.name ? resolve(user.name) : error('missing name');
|
|
110
110
|
|
|
111
|
-
const user =
|
|
112
|
-
|
|
113
|
-
);
|
|
114
|
-
const name = future_flatten_then(
|
|
115
|
-
future_and_then(user, displayName)
|
|
116
|
-
);
|
|
111
|
+
const user = future_coincide_then(resolve(42), findUser);
|
|
112
|
+
const name = future_coincide_then(user, displayName);
|
|
117
113
|
// Future<
|
|
118
114
|
// string,
|
|
119
115
|
// 'fetching user' | 'formatting name',
|
package/package.json
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"publishConfig": {
|
|
19
19
|
"access": "public"
|
|
20
20
|
},
|
|
21
|
-
"version": "1.0.
|
|
21
|
+
"version": "1.0.3",
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@tanstack/react-query": "5.101.4",
|
|
24
24
|
"react": "19.2.8"
|
|
@@ -33,6 +33,6 @@
|
|
|
33
33
|
"directory": "ts/future"
|
|
34
34
|
},
|
|
35
35
|
"bugs": {
|
|
36
|
-
"url": "https://github.com/zemn-me/monorepo/issues/new?title=%2F%2Fts%2Ffuture%401.0.
|
|
36
|
+
"url": "https://github.com/zemn-me/monorepo/issues/new?title=%2F%2Fts%2Ffuture%401.0.3%3A+something+went+wrong%21"
|
|
37
37
|
}
|
|
38
38
|
}
|