@oscarpalmer/atoms 0.211.0 → 0.213.0
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/dist/color/instance.mjs +0 -1
- package/dist/color/models.d.mts +1 -1
- package/dist/herald.d.mts +2 -1
- package/dist/index.d.mts +79 -69
- package/dist/index.mjs +57 -49
- package/dist/internal/herald.d.mts +2 -38
- package/dist/internal/herald.mjs +4 -14
- package/dist/internal/models/herald.model.d.mts +60 -0
- package/dist/internal/models/herald.model.mjs +15 -0
- package/dist/internal/models/plan.model.d.mts +14 -12
- package/dist/internal/string/misc.mjs +0 -1
- package/dist/models.d.mts +3 -3
- package/dist/plan/generate.d.mts +2 -2
- package/dist/plan/generate.mjs +5 -5
- package/dist/plan/index.mjs +1 -1
- package/dist/plan/is.d.mts +31 -2
- package/dist/plan/is.mjs +45 -1
- package/dist/plan/misc.d.mts +21 -2
- package/dist/plan/misc.mjs +32 -2
- package/dist/plan/result.d.mts +6 -6
- package/dist/plan/result.mjs +6 -6
- package/dist/plan/run.d.mts +5 -5
- package/dist/plan/run.mjs +5 -5
- package/dist/promise/models.d.mts +4 -4
- package/dist/result/work/flow.mjs +0 -1
- package/dist/result/work/pipe.mjs +0 -1
- package/dist/value/shake.d.mts +2 -2
- package/package.json +2 -1
- package/dist/internal/plan.d.mts +0 -45
- package/dist/internal/plan.mjs +0 -70
package/dist/internal/plan.mjs
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { GENERATOR_NAME_ASYNC, GENERATOR_NAME_SYNC, PLAN_SYMBOL, PLAN_TYPE_PLAN_ASYNC, PLAN_TYPE_PLAN_SYNC } from "./models/plan.model.mjs";
|
|
2
|
-
//#region src/internal/plan.ts
|
|
3
|
-
/**
|
|
4
|
-
* Create an immediately failing generator
|
|
5
|
-
*
|
|
6
|
-
* @param reason Failure reason
|
|
7
|
-
* @returns Failing generator
|
|
8
|
-
*/
|
|
9
|
-
function fail(reason) {
|
|
10
|
-
return (function* () {
|
|
11
|
-
yield;
|
|
12
|
-
throw reason;
|
|
13
|
-
})();
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Is the value an asynchronous generator function?
|
|
17
|
-
*
|
|
18
|
-
* @param value Value to check
|
|
19
|
-
* @returns `true` if the value is an asynchronous generator function, otherwise `false`
|
|
20
|
-
*/
|
|
21
|
-
function isAsyncGenerator(value) {
|
|
22
|
-
return isGeneratorInstance(GENERATOR_NAME_ASYNC, value);
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Is the value an asynchronous plan?
|
|
26
|
-
*
|
|
27
|
-
* @param value Value to check
|
|
28
|
-
* @returns `true` if the value is an asynchronous plan, otherwise `false`
|
|
29
|
-
*/
|
|
30
|
-
function isAsyncPlan(value) {
|
|
31
|
-
return isPlanInstance(PLAN_TYPE_PLAN_ASYNC, value);
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Is the value a generator function?
|
|
35
|
-
*
|
|
36
|
-
* @param value Value to check
|
|
37
|
-
* @returns `true` if the value is a generator function, otherwise `false`
|
|
38
|
-
*/
|
|
39
|
-
function isGenerator(value) {
|
|
40
|
-
return isGeneratorInstance(GENERATOR_NAME_SYNC, value);
|
|
41
|
-
}
|
|
42
|
-
function isGeneratorInstance(name, value) {
|
|
43
|
-
return typeof value === "function" && value !== null && value.constructor.name === name && typeof value.prototype.next === "function" && typeof value.prototype.return === "function" && typeof value.prototype.throw === "function";
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Is the value a plan?
|
|
47
|
-
*
|
|
48
|
-
* @param value Value to check
|
|
49
|
-
* @returns `true` if the value is a plan, otherwise `false`
|
|
50
|
-
*/
|
|
51
|
-
function isPlan(value) {
|
|
52
|
-
return isPlanInstance(PLAN_TYPE_PLAN_SYNC, value);
|
|
53
|
-
}
|
|
54
|
-
function isPlanInstance(type, value) {
|
|
55
|
-
return typeof value === "object" && value !== null && PLAN_SYMBOL in value && value[PLAN_SYMBOL].type === type;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Create an immediately succeeding generator
|
|
59
|
-
*
|
|
60
|
-
* @param value Success value
|
|
61
|
-
* @returns Succeeding generator
|
|
62
|
-
*/
|
|
63
|
-
function succeed(value) {
|
|
64
|
-
return (function* () {
|
|
65
|
-
yield;
|
|
66
|
-
return value;
|
|
67
|
-
})();
|
|
68
|
-
}
|
|
69
|
-
//#endregion
|
|
70
|
-
export { fail, isAsyncGenerator, isAsyncPlan, isGenerator, isPlan, succeed };
|