Class: EnvFile
A collection of environment variables.
Extends​
BaseClient
Constructors​
Constructor​
new EnvFile(
ctx?
,_id?
,_exists?
,_get?
):EnvFile
Constructor is used for internal usage only, do not create object from it.
Parameters​
ctx?​
Context
_id?​
_exists?​
boolean
_get?​
string
Returns​
EnvFile
Overrides​
BaseClient.constructor
Methods​
asFile()​
asFile():
File
Return as a file
Returns​
exists()​
exists(
name
):Promise
<boolean
>
Check if a variable exists
Parameters​
name​
string
Variable name
Returns​
Promise
<boolean
>
get()​
get(
name
):Promise
<string
>
Lookup a variable (last occurrence wins) and return its value, or an empty string
Parameters​
name​
string
Variable name
Returns​
Promise
<string
>
id()​
id():
Promise
<EnvFileID
>
A unique identifier for this EnvFile.
Returns​
Promise
<EnvFileID
>
variables()​
variables():
Promise
<EnvVariable
[]>
Return all variables
Returns​
Promise
<EnvVariable
[]>
with()​
with(
arg
):EnvFile
Call the provided function with current EnvFile.
This is useful for reusability and readability by not breaking the calling chain.
Parameters​
arg​
(param
) => EnvFile
Returns​
EnvFile
withoutVariable()​
withoutVariable(
name
):EnvFile
Remove all occurrences of the named variable
Parameters​
name​
string
Variable name
Returns​
EnvFile
withVariable()​
withVariable(
name
,value
):EnvFile
Add a variable
Parameters​
name​
string
Variable name
value​
string
Variable value
Returns​
EnvFile