Class: Config
config.Config
Config class returned on load.
Constructors
constructor
• new Config(path
, data
): Config
Parameters
Name | Type |
---|---|
path |
string |
data |
any |
Returns
Properties
data
• Readonly
data: any
Parsed YML data.
path
• Readonly
path: string
Path where the config was loaded from.
Methods
get
▸ get(path
): any
Get an optional property value from the config. Returns undefined
if not found.
Parameters
Name | Type | Description |
---|---|---|
path |
string |
The path of the property to get |
Returns
any
▸ get(path
, type
): string
Parameters
Name | Type |
---|---|
path |
string |
type |
"string" |
Returns
string
▸ get(path
, type
): number
Parameters
Name | Type |
---|---|
path |
string |
type |
"number" |
Returns
number
▸ get(path
, type
): boolean
Parameters
Name | Type |
---|---|
path |
string |
type |
"boolean" |
Returns
boolean
▸ get(path
, type
): string
[]
Parameters
Name | Type |
---|---|
path |
string |
type |
"string[]" |
Returns
string
[]
require
▸ require(path
): any
Get a required property value from the config. Throws an error if not found.
Parameters
Name | Type | Description |
---|---|---|
path |
string |
The path of the property to get |
Returns
any
▸ require(path
, type
): string
Parameters
Name | Type |
---|---|
path |
string |
type |
"string" |
Returns
string
▸ require(path
, type
): number
Parameters
Name | Type |
---|---|
path |
string |
type |
"number" |
Returns
number
▸ require(path
, type
): boolean
Parameters
Name | Type |
---|---|
path |
string |
type |
"boolean" |
Returns
boolean
▸ require(path
, type
): string
[]
Parameters
Name | Type |
---|---|
path |
string |
type |
"string[]" |
Returns
string
[]
resolve
▸ resolve(fileref
): string
Resolve a relative file reference from the config to an absolute path. Throws an error if not found.
Parameters
Name | Type | Description |
---|---|---|
fileref |
string |
The path of the property to get |
Returns
string