Skip to content

Commit

Permalink
Support in operator for Snapshot.actions
Browse files Browse the repository at this point in the history
  • Loading branch information
clebert committed Feb 19, 2024
1 parent 073c36e commit 5df0d0b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ seamless integration with TypeScript. It facilitates deterministic behavior by o
encapsulated state machine, user-defined actions and state transformers, as well as automatic stale
snapshot invalidation.

_511 B with all dependencies, minified and gzipped._
_524 B with all dependencies, minified and gzipped._

## Installation

Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,19 @@
"size-limit": [
{
"name": "brotli compression",
"limit": "463 B",
"limit": "473 B",
"path": "./lib/mod.js",
"brotli": true
},
{
"name": "gzip compression",
"limit": "511 B",
"limit": "524 B",
"path": "./lib/mod.js",
"gzip": true
},
{
"name": "no compression",
"limit": "463 B",
"limit": "473 B",
"path": "./lib/mod.js",
"gzip": false
}
Expand Down
6 changes: 6 additions & 0 deletions src/create_machine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,12 @@ export function createMachine<
const actions = new Proxy(
{},
{
has(_, actionName) {
assertVersion();

return actionName in transitionsMap[currentState];
},

get(_, actionName) {
assertVersion();

Expand Down

0 comments on commit 5df0d0b

Please sign in to comment.