@doeixd/machine 1.1.0 → 1.2.1
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 +3 -1
- package/dist/cjs/development/index.js +9 -0
- package/dist/cjs/development/index.js.map +3 -3
- package/dist/cjs/development/minimal.js +9 -0
- package/dist/cjs/development/minimal.js.map +3 -3
- package/dist/cjs/production/index.js +3 -3
- package/dist/cjs/production/minimal.js +1 -1
- package/dist/esm/development/index.js +9 -0
- package/dist/esm/development/index.js.map +3 -3
- package/dist/esm/development/minimal.js +9 -0
- package/dist/esm/development/minimal.js.map +3 -3
- package/dist/esm/production/index.js +3 -3
- package/dist/esm/production/minimal.js +1 -1
- package/dist/types/types.d.ts +47 -0
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/types.ts +44 -0
package/README.md
CHANGED
|
@@ -59,7 +59,9 @@ type Machine<C extends object> = {
|
|
|
59
59
|
**Flexibility**: Unlike rigid FSM implementations, you can choose your level of immutability. Want to mutate? You can. Want pure functions? You can. Want compile-time state validation? Type-State Programming gives you that.
|
|
60
60
|
|
|
61
61
|
**Read more about our core principles:** [ 📖 Core Principles Guide ](./docs/principles.md)
|
|
62
|
-
**
|
|
62
|
+
**Learn about our recent refinements and workflows:** [ 🚀 Evolution & Workflows ](./docs/evolution.md)
|
|
63
|
+
**Prefer simplicity and little abstraction?** [ 🧘 The Minimalist's Manifesto (YAGNI) ](./docs/yagni.md)
|
|
64
|
+
**Explore our utility helpers (tag, isState, tag.factory, States):** [ 🏷️ Tagged Helpers & Utilities ](./docs/tagged-helpers.md)
|
|
63
65
|
|
|
64
66
|
## Choosing the Right Pattern
|
|
65
67
|
|
|
@@ -2192,6 +2192,15 @@ function tag(nameOrObj, props) {
|
|
|
2192
2192
|
}
|
|
2193
2193
|
return { tag: nameOrObj };
|
|
2194
2194
|
}
|
|
2195
|
+
((tag2) => {
|
|
2196
|
+
function factory2(name) {
|
|
2197
|
+
if (name) {
|
|
2198
|
+
return (props) => tag2(name, props);
|
|
2199
|
+
}
|
|
2200
|
+
return (name2) => (props) => tag2(name2, props);
|
|
2201
|
+
}
|
|
2202
|
+
tag2.factory = factory2;
|
|
2203
|
+
})(tag || (tag = {}));
|
|
2195
2204
|
function isState2(machine2, tagValue) {
|
|
2196
2205
|
return machine2.tag === tagValue;
|
|
2197
2206
|
}
|