mjstahl / stated

Simply put state management for your JavaScript application
https://www.npmjs.com/package/@mjstahl/stated
MIT License
4 stars 0 forks source link

reset() does not reset values, only state #9

Open mjstahl opened 5 years ago

mjstahl commented 5 years ago

reset needs to reset the entire state machine to how it was when instantiated. Maybe right now, we just save a copy to be used when resetting.

mjstahl commented 5 years ago

This is going to be more difficult than previously imagined. Most cloning techniques (using Object.assign for example) are only shall clones.

We need a deep clone that can handle functions (JSON (de)serialization is out). And importing ONLY the lodash.clonedeep increases this package to over 3K