1.0.2 • Published 7 years ago
args-provider v1.0.2
Install
$ npm install --save args-providerUsage
const Context = require('args-provider');
function a() {
Context.setMulti(this, {'name': 'hello'})
Context.apply(this, b, 1, 2, 3)
// b(1,2,3)
}
function b(a, c, d) {
console.log(a, c, d, Context.get(this, 'name'))
}
Context().apply(a)Methods
instance Methods:
get(name)
get by nameset(name, val)
set argument by key-valapply(fn)
bind 'this' that refs to Context to the fnstatic Methods:
get(ctx, name)
the same as getset(ctx, name)
the same as setsetMulti(ctx, params)
set argument by multi key-valapply(ctx, fn)
the same as apply