Aside from collections, Rimbu also offers tools to handle plain JS/TypeScript objects as immutable objects. These tools do not actually add functionality or change those plain objects, but use the compiler's type checking to offer protection against modifying data in objects.
Protected type and the
protected function cast a plain JS object to an object that, according to its type, is deeply readonly.
See Protected for more information.
With immutable objects its often desirable to create copies where some properties are modified. The
patch function offers a convenient way to do this.
See Patch for more information.
In a similar fashion to
Match object offers methods to easily check if data in an object satisfies a number of characteristics.
See Match for more information.
Sometimes it is convenient to use a string to identify a path within a nested object where a property can be found. The
Path object offers methods to both patch and get a value from an object using a string path, and accurately type the result.
See Path for more information.
Sometimes it is useful to create immutable tuples as data. However, with the TS compiler type inference it is sometimes challenging to get the types right. The
Tuple constructor helps in this case.
See Tuple for more information.