Skip to main content

Class: AsyncEnvironment

@kosko/env.AsyncEnvironment

Hierarchy#

  • BaseEnvironment

    AsyncEnvironment

Constructors#

constructor#

+ new AsyncEnvironment(cwd: string): AsyncEnvironment

Parameters:#

NameType
cwdstring

Returns: AsyncEnvironment

Defined in: packages/env/src/environment/base.ts:27

Properties#

cwd#

cwd: string


env#

Optional env: string | string[]

Current environment.

Defined in: packages/env/src/environment/base.ts:12


extensions#

extensions: string[]

File extensions of environments.

Defined in: packages/env/src/environment/base.ts:25


paths#

paths: Paths

Paths of environment files.

Defined in: packages/env/src/environment/base.ts:17


reducers#

Protected reducers: Reducer[]

Defined in: packages/env/src/environment/base.ts:7

Methods#

component#

component(name: string): any

Returns component variables merged with global variables.

If env is not set or require failed, returns an empty object.

Parameters:#

NameTypeDescription
namestringComponent name

Returns: any

Defined in: packages/env/src/environment/base.ts:53


execReducers#

ProtectedexecReducers(name?: string): any

Parameters:#

NameType
name?string

Returns: any

Defined in: packages/env/src/environment/async.ts:8


global#

global(): any

Returns global variables.

If env is not set or require failed, returns an empty object.

Returns: any

Defined in: packages/env/src/environment/base.ts:42


mergeValues#

ProtectedmergeValues(values: any[]): any

Parameters:#

NameType
valuesany[]

Returns: any

Defined in: packages/env/src/environment/async.ts:12


requireModule#

ProtectedrequireModule(id: string): Promise<any>

Parameters:#

NameType
idstring

Returns: Promise<any>

Defined in: packages/env/src/environment/async.ts:16


resetReducers#

resetReducers(): void

Resets reducers to the defaults.

Returns: void

Defined in: packages/env/src/environment/base.ts:67


setReducers#

setReducers(callbackfn: (reducers: Reducer[]) => Reducer[]): void

Sets list of reducers using the specified callback function.

Parameters:#

NameType
callbackfn(reducers: Reducer[]) => Reducer[]

Returns: void

Defined in: packages/env/src/environment/base.ts:60