1.6.0 • Published 6 years ago
ts-lens v1.6.0
Lens
A lens is a getter/ setter for traversing a structure. A lens is also composable with other lenses, allowing traversing via a object or using projections. functional-lenses
Realize that the only dependency is the Object.assign from es6
Using
import { idLens } from 'ts-lens';
type MyShape = {
a?:{
b: {
c: string
}
}
}
const withShape = idLens<MyShape>();
withShape.withAttrOr('a', { b: { c: ''}}).get({}) // ? { b: { c: ''}}
withShape.withAttrOr('a', { b: { c: ''}}).withAttr('b').withAttr('b').get({a:{
b: {
c: 'test
}
}}) // 'b'
1.6.0
6 years ago
1.5.7
6 years ago
1.5.5
6 years ago
1.5.4
6 years ago
1.5.3
6 years ago
1.5.2
7 years ago
1.3.1
7 years ago
1.2.9
7 years ago
1.2.8
7 years ago
1.2.7
7 years ago
1.3.0
7 years ago
1.2.5
7 years ago
1.2.4
7 years ago
1.2.3
7 years ago
1.2.2
7 years ago
1.2.1
7 years ago
1.2.0
7 years ago
1.1.0
7 years ago
1.0.0
7 years ago