Skip to content

Add experimental support for "unmutable compatible" data types

Compare
Choose a tag to compare
@dxinteractive dxinteractive released this 25 Sep 04:03
· 179 commits to master since this release
  • Experimental support has been added for custom data types, such as classes that you may write yourself. For a class instance to be unmutable compatible, it must have a key of __UNMUTABLE_COMPATIBLE__ and set this to true. When unmutable finds this key on a value, it will try to call a method on that value and pass all arguments through. It is up to you to write the behaviour of each of the methods that unmutable may call on your class, and to ensure these behave immutably. If a method cannot be found on the value, and if a type-agnostic execution for the current function already exists in unmutable (this is a function called "all" in the unmutable source code), then unmutable will use the type-agnostic function instead. This means that by implementing a few basic methods like has, get, set, delete, entries etc, you should also be able to use unmutable functions such as getIn, update, find etc.
  • No breaking changes