Mixins with smart merging strategies and errors over silent failure.
Install with one of:
# recommended npm install --save smart-mixin # will expose window.smartMixin or the smartMixin AMD module curl 'wzrd.in/standalone/smart-mixin@2' > vendor/smart-mixin.js
Usage:
var mixins = ; // define a mixin behaviorvar mixIntoGameObject = ; // simple usage examplevar mixin = { return bar: foo+1 }; { console; // {baz: 4, bar: 6} } { return baz: foo - 1 } // apply the mixin; // use it;
That's it
Nothing too crazy, this was mostly built for use in react-class-mixins, but hopefully is useful to other people. I'll be adding more test coverage (the mixin.FN apis are fully tested, but not the actual mixin function). Any bug reports will be fixed ASAP.
License
MIT