1.0.0 • Published 9 years ago

dynvar v1.0.0

Weekly downloads
3
License
CC0-1.0
Repository
github
Last release
9 years ago

dynvar Travis npm npm

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