mixin traits into objects
npm install entity/traits
component install entity/traits
var traits = require('traits');
var t = traits();
t('foo', function(){
this.foo = true;
});
t('bar', function(){
this.bar = true;
});
var foobar = {};
t.call(foobar, 'foo', 'bar');
console.log(foobar); // { foo: true, bar: true }
Factory a trait
function.
Defines a trait
using fn
.
Apply one or more traits to object
.
MIT