VariableCollection class

Authoring-time collection of a stack's deployment variables. Backed by an ordered private array; supports add/get/delete/iteration. Look variables up by name via VariableCollection.get.

Properties

size

Methods

add<TValue>(string, TValue, VariableOptions)

Add a variable; returns its expression handle. Throws on duplicate name.

delete(string)

Remove a variable by name. Returns whether one was removed.

get(string)

The expression handle for a variable, or undefined.

getMetadata(string)

The declaration metadata for a variable, or undefined.

has(string)
list()

All variable handles, in insertion order.

listMetadata()

All declaration metadata, in insertion order.

[iterator]()

Property Details

size

number size

Property Value

number

Method Details

add<TValue>(string, TValue, VariableOptions)

Add a variable; returns its expression handle. Throws on duplicate name.

function add<TValue>(name: string, value: TValue, options?: VariableOptions): Variable<TValue>

Parameters

name

string

value

TValue

options
VariableOptions

Returns

Variable<TValue>

delete(string)

Remove a variable by name. Returns whether one was removed.

function delete(name: string): boolean

Parameters

name

string

Returns

boolean

get(string)

The expression handle for a variable, or undefined.

function get(name: string): Variable<VariableValue> | undefined

Parameters

name

string

Returns

Variable<VariableValue> | undefined

getMetadata(string)

The declaration metadata for a variable, or undefined.

function getMetadata(name: string): VariableMetadata | undefined

Parameters

name

string

Returns

VariableMetadata | undefined

has(string)

function has(name: string): boolean

Parameters

name

string

Returns

boolean

list()

All variable handles, in insertion order.

function list(): readonly Variable<VariableValue>[]

Returns

readonly Variable<VariableValue>[]

listMetadata()

All declaration metadata, in insertion order.

function listMetadata(): readonly VariableMetadata[]

Returns

readonly VariableMetadata[]

[iterator]()

function [iterator](): IterableIterator<Variable<VariableValue>>

Returns

IterableIterator<Variable<VariableValue>>