How to use the monocle-ts/lib.Lens.fromProp function in monocle-ts

To help you get started, we’ve selected a few monocle-ts examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gcanti / newtype-ts / test / index.ts View on Github external
it('should allow optic management', () => {
    const person: Person = {
      name: 'Giulio',
      age: age.wrap(43)
    }
    const ageLens = Lens.fromProp()('age').compose(age.asLens())
    assert.deepEqual(ageLens.set(44)(person), {
      name: 'Giulio',
      age: 44
    })
  })
})