mixwith.js
mixwith.js copied to clipboard
Thanks for the inspiration!
I read your blog post and browsed this repo and it is amazing stuff you have here! I got really inspired by your work so I ran with it and created this library, loosely based on mixwith:
mics
It looks a lot like yours with some (big) differences:
- I merged
mixandmixininto one withis optional syntax sugarmixcan return a mixin instead of a class- mixins can be used to instantiate an object directly
mixcan combine multiple mixins into a new one
I found that creating an actual class is often not desirable because it limits the potential uses for the code. Instead, mics promotes the use of mixins everywhere:
import { mix, is } from 'mics'
var Looker = mix(superclass => class Looker extends superclass {
look() {
console.info('Looking good!')
}
})
// directly instantiate a looker:
var looker = new Looker()
looker.look()
Thanks again for inspiring me and I'd love to get some feedback from the master!