Closed yields closed 10 years ago
https://github.com/component/model/blob/master/lib/static.js#L97
so instead of fn(this) do fn.call(fn, this).
fn(this)
fn.call(fn, this)
IMHO this gives you a lot of flexibility when building plugins, for example you could build plugins like so:
model.use(new Plugin()) function Plugin(){} Plugin.prototype.call = function(model){};
also you can configure plugins in a nice-ish way
plugin = Plugin() .set('foo', 'baz') .set('baz', 'foo'); User = model('User').use(plugin);
nvm
https://github.com/component/model/blob/master/lib/static.js#L97
so instead of
fn(this)
dofn.call(fn, this)
.IMHO this gives you a lot of flexibility when building plugins, for example you could build plugins like so:
also you can configure plugins in a nice-ish way