Description
Simple mixin implementation.
Latest Version
1.0.1
Installation
npm install dotmix --save
Usage
Add a "mix" method to a source like this:
var Dotmix = ; var Blah = { return { return datagreeting + ' ' + text; } } extend : { return "NOW BARFING: " + food; } ; ; moduleexports = Blah;
Mixin sources should be objects with include and/or extend attributes. Their values can be either an object, or if you want to pass configuration data, functions accepting that single data argument and returning an object.
You mix into a target like this:
var Blah = ; { thisderp = derp;} Blah; barf = ;barf; // wow... barf!!Barf; // NOW BARFING: pancakes
It's also possible to use the Dotmix.mix method directly
var Dotmix = ; var Foo = include : { return 'food'; } ; { thisderp = derp;} Dotmix; duh = ;duh // 'food'
Notes
Includes ideas from
TODO
- list of mixin sources (probably just subset of npm modules that have "dotmix" as a package.json keyword)