-
Notifications
You must be signed in to change notification settings - Fork 8
Home
James edited this page May 29, 2017
·
12 revisions
interfaces that describe their intentions
class Traditional {
constructor() {
this.data = {}
}
build(index, name, object) {
this.data.index = index
this.data.name = name
this.data.object = object
}
}
const classico = new Traditional()
classico.build(1, 'string', {object: true})
class Chain extends Chainable {
constructor(parent) {
super(parent)
this.extend(['index', 'name', 'object'])
}
}
const chain = new Chainable()
.index(1)
.name('string')
.object(true)
writing an api using chain-able means writing 1 fluent api, but getting 3 apis as a result!
- 🍉 persistable, rehydratable, & transferrable configurations
- ⛓ fluent/chainable api
- 🍦 vanilla object syntax
- ⚡ performant & tiny
- lib is 7.5kb (gzip)
- 300 byte minimal version available as snippet
▶️ ◀️ easy deep merging- 🌐 api
- 🤖 transformable
- 🎼 composable
- 💪 powerful
- based on webpack-chain, but not webpack-specific.
- Martin Fowler on FluentInterface