1.0.1 • Published 11 years ago
with-scope v1.0.1
with-scope v1.0.1 
Expose the properties of a given Object as local variables to a given Function.
npm install with-scopeusage
var withScope = require("with-scope")
var scope = { hello: "world" }
withScope(scope, function () {
console.log(hello)
})CoffeeScript-generated functions have their first var statement cleaned of any properties found in __scope!
withScope = require "with-scope"
scope = hello: "world"
# The function passed to `withScope` would override `__scope.hello` with `var hello;` but this library fixes that for you!
withScope scope, ->
hello ?= "<no value>"
# This should still print "world".
console.log hellotests
All tests are passing! Find out for yourself:
npm install -g jasmine-node
npm testchangelog
1.0.1
+ CoffeeScript support
1.0.0
+ Initial release