make-overridable
v1.0.6
Published
Override design pattern for JavaScript.
Downloads
8
Readme
make-overridable
Override design pattern for JavaScript.
Example
const makeOverridable = require('make-overridable')
const a = makeOverridable(x => x)({
foo: 'a',
bar: 'a',
})
a.foo === 'a'
a.bar === 'a'
const b = a.override({ foo: 'b' })
b.foo === 'b'
b.bar === 'a'
const c = b.override({ bar: 'c' })
b.foo === 'b'
b.bar === 'c'