Skip to content

env variable()

Eugene Lazutkin edited this page Apr 3, 2026 · 1 revision

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

Clone this wiki locally