confi-helpers v1.0.0
Confi Helpers is not designed to be used directly. It is used by Confi.
Helpers:
exists(name)
Checks if a var is set.
name- name of the variable to check.
Returns: boolean
getEnv(name, [fallback])
Gets an environment variable.
name- the environment variable to grab.fallback- a fallback value to use if the environment variable is not set.
Returns: string - Value of environment variable or thrown error if name doesn't exist and no fallback provided.
getEnvInt(name, [fallback])
Gets an environment variable.
name- the environment variable to grab.fallback- a fallback value to use if the environment variable is not set.
Returns: int - Value of environment variable, casted to an integer or thrown error if name doesn't exist and no fallback provided.
getEnvOrFilename(name)
Reads a file or returns value of an environment variable.
name- Name of the environment variable.
Returns: string - Contents of a file or value of the environment variable. If variable not found error will be thrown.
hasValue(value)
Checks if a passed variable has a value and isn't null, undefined, or empty.
Note: Arrays and objects are not checked.
value- Passed variable to check.
Returns: boolean
readFile(name)
Checks if a passed variable has a value and isn't null, undefined, or empty.
Note: Arrays and objects are not checked.
name- Filename
Returns: string File contents.
truthy(value, [fallback])
Checks if a value is truthy.
value- value to check.fallback- defaults tofalse
Returns: boolean
truthyEnv(name, [fallback])
Checks if an environment variable is truthy.
value- name of the environment variable.fallback- defaults tofalse
Returns: boolean
ms(value)
Converts a value to milliseconds. Uses the ms package.
value- value to convert.
Returns: mixed
A First + Third Project