Skip to main content

@midnight-ntwrk/midnight-js-contracts v0.1.15 • API


Midnight.js API Reference v0.1.15 / @midnight-ntwrk/midnight-js-contracts / utils / Lens

Type alias: Lens<S, F>

Lens<S, F>: Object

A function getter + setter abstraction. Despite deceptively simple API it is quite powerful in kinds of relationships it allows to represent

Type parameters

S

the parent type

F

the focus type we want to access from the parent

Type declaration

get

get: (state) => F

Parameters

state: S

Returns

F

set

set: (focus, state) => S

Parameters

focus: F

state: S

Returns

S