push-and-pop
Scoping the easy way.
Installation
$ npm install push-and-pop
Usage
const scope: settings push pop = angleMode: "radians"; const cosine = { }; const deepStrictEqual: equal = ; ; // 1 // Change the settings...;; // 1 // ...And change them back.;
API
require("push-and-pop")(properties = {})
Create an object p
containing scope
, push
, and pop
The scope is a null object, so it doesn't have methods like toString
.
p.scope
An object with properties
from a call to require("push-and-pop")
.
p.push(properties = {})
Add properties to a scope
that can be pop
ped off later.
p.pop(times = 1)
Pop a layer off the scope zero or more times
.