Skip to main content

Module algebra

Module algebra 

Source
Expand description

Object algebra: pick, omit, partial and extend build a new object shape out of an existing one. The result is a fresh node, so the source is left as it was and one base can be reshaped many times. Key expressions in a source ({"a: Min(2)": 0}) are compiled on the way in, since the algebra has to know the real property names.

Structs§

Names
The property names an algebra builder is given: one, or a list.

Functions§

extend
Add the properties of another object shape; a property both declare takes the extension’s. The result stays open or closed as the base was.
omit
Drop the named properties of an object shape. A name the shape does not declare is simply not there to drop.
partial
Make every declared property of an object shape optional, as optional would: a type token then injects its empty value, a literal its own. Shallow: a nested object’s own properties are as they were.
pick
Keep only the named properties of an object shape. Naming one the shape does not declare is a fault: there is nothing there to pick.