es6-mixin
Minimalist mixin helper designed to be used with ES6 (ES2015) classes.
Installation
npm install --save es6-mixin
Usage
mix(SuperClass, Mixin1, Mixin2, ...)
;{return 'foo';}{return 'bar';}{return 'baz';}Super Mixin1 Mixin2; // => 'foo'; // => 'bar'; // => 'baz'instanceof Super; // => trueinstanceof Mixin1; // => falseinstanceof Mixin2; // => false
mixin(target, Mixin [, arg1, arg2, ...])
Basic usage
;{return 'foo';}{;}; // => 'foo'
Pass parameters to a constructor
;{ ... }{return 'foo';}{; // 1, 2, 3 are passed to Foo's constructor}; // => 'foo'
Use with ES5-style prototypes
;{}Fooprototype {return 'foo';};{;}; // => 'foo'
class extends Mixin { ... }
;{return 'foo';}{Foo;}; // => 'foo'