0.2.2 • Published 7 years ago

coelacanth v0.2.2

Weekly downloads
2
License
GPL-3.0
Repository
github
Last release
7 years ago

coelacanth

Build Status npm npm GitHub issues

Derivation based config management with defaults and overrides.

The problem

You want a config object with certain defaults and some reactive derived key-value pairs. Overrides to any of these values should take precedence.

import Coelacanth from 'coelacanth'

const configData = {
  x: 40,
  y: 32,
  margins: {
    top: 10
  }
}

let conf = new Coelacanth(configData)
conf.x // 40

conf.margins.derive('bottom', (node, root) => node.top + root.x)
conf.margins.bottom // 50

conf = conf.overwrite({margins: {top: 30}})
conf.margins.bottom // 70