dynvar
v1.0.0
Published
Dynamic variable support for JS
Downloads
3
Readme
dynvar
dynvar
provides dynamically-scoped variables
within a synchronous scope.
Quickstart
Install
$ npm install dynvar
Example
var dynvar = require('dynvar')
dynvar.define('stdout', process.stdout)
function print (thing) {
var stream = dynvar('stdout')
if (stream) { stream.write(''+thing) }
}
dynvar.bind({stdout: null}, function () {
print('this will not print anything')
})
print('foo') // foo