Module: core/helper

Exports generic functions that can serve multiple (core) classes.
Author:
  • ruckola
Source:

Methods

(static) getAbsolutPath(relativePath) → {string}

Converts a relative path (inside your project) into an absolute path.
Parameters:
Name Type Description
relativePath string relative filepath
Source:
Returns:
absolutePath - absolute path normalized for the current OS.
Type
string

(static) getModConfig(testModeopt) → {Object}

Reads the modules config.json file and returns the content as object. Any errors will be logged to the console. (runs in sync | blocking code)
Parameters:
Name Type Attributes Default Description
testMode boolean <optional>
false if set to true, the configuration for the test-environment will be loaded, instead of the user configuration.
Source:
Returns:
result - an object with three properties. See example output.
Type
Object
Example

Sample result object

{
      userConfigFile: "/home/username/project/bin/mc/config/config.json",
      userHelperDir: "/home/username/project/bin/mc/helper",
      userCommandsRootDir: "/home/username/project/bin/mc/commands"
}
 

(static) ucfirst(str)

Converts the first character of a string to uppercase.
Parameters:
Name Type Description
str string string to be converted
Source: