Interoperability#
Experimental
This module is experimental and may receive backwards incompatible changes without a corresponding semver bump.
Since optics-ts v2.2.0, there are two syntaxes for optics: method chaining and standalone optics. The interoperability API, documented here, defines a bridge between the two syntaxes, giving e.g. library authors the freedom to allow their users to use either syntax.
Everything below assumes the following import:
import * as I from 'optics-ts/interop
This module defines the following functions:
I.get :: (optic, value) => valueI.preview :: (optic, value) => value | undefinedI.collect :: (optic, value) => value[]I.modify :: (optic, fn, value) => valueI.set :: (optic, fn, value) => value
The optic parameter for these function can be any of:
- A method chaining optic
- A standalone optic
Otherwise the functions work exactly like the corresponding operations in either API.