Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

dynvar

zkat7CC0-1.01.0.0

Dynamic variable support for JS

dynamic-variable, lisp, scope

readme

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