Skip to content

valeriangalliat/make-overridable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

make-overridable npm version

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'

About

Override design pattern for JavaScript.

Resources

License

Stars

Watchers

Forks