Skip to main content

Class: Environment

@kosko/env.Environment

Hierarchy#

  • BaseEnvironment

    Environment

Constructors#

constructor#

+ new Environment(cwd: string): Environment

Parameters:#

NameType
cwdstring

Returns: Environment

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/sync.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/sync.ts:12


requireModule#

ProtectedrequireModule(id: string): any

Parameters:#

NameType
idstring

Returns: any

Defined in: packages/env/src/environment/sync.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