-
-
Notifications
You must be signed in to change notification settings - Fork 0
env: variable()
Eugene Lazutkin edited this page Jan 11, 2022
·
2 revisions
This is a convenient factory function for Variable objects.
variable()
is defined in env and can be accessed like that:
import {variable} from 'deep6/env.js';
The current implementation:
const variable = name => new Variable(name);
Example of use:
import {variable} from 'deep6/env.js';
const x = variable(), // anonymous
y = variable('pilot'), // named
z = variable(Symbol.for('trend')), // uses a global symbol
a = variable('pilot'), // the same as "y" above
b = variable(Symbol.for('trend')), // the same as "z" above
c = variable(Symbol('rocket')); // uses a named symbol