Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a total rewrite of the whole library in TypeScript, and the changes are almost completely compatible with the original version.
rollup
instead ofwebpack
with three formats:umd
,cjs
andes
.class
.bin/example.js
and the example state machines in theexamples
folder) was modified accordingly and all work.test
folder usingjest
instead ofava
, due toava
requiring changes that conflicts withrollup
(look at this ava issue) in order to support TypeScript.test-js
folder with minimal changes which will be covered later. All test cases passed except one.const machine = StateMachine()
anymore without thenew
keyword. One of the test cases was covering this, which is the case that didn't pass.factory
method to create the machine and you have an base class constructor, you don't need to explicitly runthis._fsm()
in it anymore.apply
method to extend your object to a state machine, you will get a new object instead of mutating the original object, that is runningStateMachine.apply(obj)
and useobj
as it is, you have to doconst newObj = StateMachine.apply(obj)
and usenewObj
instead.All in all, changes are mostly compatible with a few enhancements, and with type support .