kube / monolite

Statically-typed structural-sharing tree modifier
https://www.npmjs.com/package/monolite
148 stars 6 forks source link

Pipeline transformations. Solves #8 #33

Closed kube closed 6 years ago

kube commented 6 years ago

Chained Transformations

Add pipe function in the library, to allow chained transformations.

import { pipe } from 'monolite'

const updatedState =
  pipe(state)
    .set(_ => _.nested.counter, x => x + 1)
    .set(_ => _.nested.message, word => word + '!')
    .end()

Removed currying

set is not curried anymore:

import { set } from 'monolite'

const updatedState =
  set(state, _ => _.nested.counter, x => x + 1)

Removed functions

All helpers shortcuts for set were removed: