Return only the unique values in an Array.
In series, run an array of async functions
without arguments
let sleepyFunc = async () => {
await new Promise((resolve) => { setTimeout(resolve, 100) })
return (new Date()).getTime()
}
let jobs = [sleepyFunc, sleepyFunc, sleepyFunc]
let responses = await api.utils.asyncWaterfall(jobs)
// responses = [1506536188356, 1506536188456, 1506536188456]
with arguments
let sleepyFunc = async (response) => {
await new Promise((resolve) => { setTimeout(resolve, 100) })
return response
}
let jobs = [
{method: sleepyFunc, args: ['a']},
{method: sleepyFunc, args: ['b']},
{method: sleepyFunc, args: ['c']}
]
let responses = await api.utils.asyncWaterfall(jobs)
// responses = ['a', 'b', 'c']
Collapses an Object with numerical keys (like arguments in a function) to an Array
Create a directory, only if it doesn't exist yet. Throws an error if the directory already exists, or encounters a filesystem problem.
Create a file, only if it doesn't exist yet. Throws an error if the file already exists, or encounters a filesystem problem.
Create an Actionhero LinkFile, only if it doesn't exist yet. Throws an error if the file already exists, or encounters a filesystem problem.
Create a system symbolic link. Throws an error if it encounters a filesystem problem.
I build this server's ID from the external IP address of this server and pid.
Check if a directory exists.
swap out d.ts files for the JS versions when running with ts-node
Returns the average delay between a tick of the node.js event loop, as measured for N calls of process.nextTick
Check if a file exists.
Prepares acton params for logging.
Hides any sensitive data as defined by api.config.general.filteredParams
Truncates long strings via api.config.logger.maxLogStringLength
Returns this server's external/public IP address
Recursively merge 2 Objects together. Will resolve functions if they are present, unless the parent Object has the property _toExpand = false.
Actionhero uses this internally to construct and resolve the config.
Matching keys in B override A.
Is the JS Object passed in truly just an object?
Log a message, with optional metadata. The message can be logged to a number of locations (stdio, files, etc) as configured via config/logger.js
The default log levels are: 7=debug 6=info 5=notice 4=warning 3=error 2=crit 1=alert 0=emerg
Learn more at https://github.com/winstonjs/winston
the most basic use. Will assume 'info' as the severity: log('hello')
custom severity: log('OH NO!', 'warning')
custom severity with a metadata object: log('OH NO, something went wrong', 'warning', { error: new Error('things are busted') })
Transform the cookie headers of a node HTTP req Object into a hash.
Return ip and port information if defined in the header
Parse an IPv6 address, returning both host and port. see https://github.com/actionhero/actionhero/issues/275
Remove an Actionhero LinkFile, only if it exists. Throws an error if the file does not exist, or encounters a filesystem problem.
Used by generator functions running from your dist, it replaces the path with your src
Relies on api.config.general.paths
Sleep with a Promise
Sorts an Array of Objects with a priority key
Utility functions for Actionhero
Generated using TypeDoc
Compare the first n elements of an array with another, longer array