Skip to main content

Class: Namespace

Defined in: packages/core/src/Namespace.ts:7

Namespace creation, manipulation and traversal utility. This utility is used to create semi-global shared namespaces for registering references to interfaces, classes and constants of the application to provide access to each other more easily than by using the ES6 import/export mechanism.

Indexable

[key: string | number | symbol]: any

Constructors

new Namespace()

new Namespace(): Namespace

Returns

Namespace

Methods

get()

get<V>(path): undefined | V

Defined in: packages/core/src/Namespace.ts:77

Return value for the specified namespace path point or undefined if path is not type of string

Type Parameters

V = any

Parameters

path

string

The namespace path to get.

Returns

undefined | V

The value at the specified path in the namespace or undefined for any non-string path


has()

has(path): boolean

Defined in: packages/core/src/Namespace.ts:60

Verifies that the specified namespace path point to an existing namespace or terminal value.

Parameters

path

string

The namespace path to test.

Returns

boolean

true if the namespace or terminal value exists at the specified path.


namespace()

namespace<V>(path): V

Defined in: packages/core/src/Namespace.ts:36

Verifies that the specified path in namespace exists, creates it if it does not, and returns the value at the specified path in the namespace.

The method recursively creates all path parts in the namespaces as empty plain objects for all path parts that do not exist yet, including the last one. This means, that if called with a non-existing namespace path as an argument, the return value will be the last created namespace object.

Type Parameters

V = any

Parameters

path

string

The namespace path.

Returns

V

The value at the specified path in the namespace.


set()

set<V>(path, value): void

Defined in: packages/core/src/Namespace.ts:99

Set value for the specified namespace path point.

Type Parameters

V

Parameters

path

string

The namespace path to set.

value

V

Returns

void