circularmemo
A convenience function to recursively iterates over a (like typescript's types) with memoization and without breaking circular references.
It requires your function to expect itself as the first argument, and returns a similar function, you can then pass your function to a Y-combinator to get a "normal" function.
This package also provides a spreading Y combinator and the MFN
type for this kind of
self-passed function.
circle.left.left = circle assertresult.n === 2assertresult.left.n === 3assertresult.left.left === result // maintained circular
Other options
The first arguments to circularmemo
is a Param object which accepts
the following functions.
circularMarker:Marker,replaceMarker:Res useMarker?:Res,useExisting?:Res,shouldMemo?:boolean,keyMaker?:Key,