Compare the first n elements of an array with another, longer array
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
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
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.
Check if a directory exists.
Check if a file exists.
Remove an Actionhero LinkFile, only if it exists. Throws an error if the file does not exist, or encounters a filesystem problem.
Prepares acton params for logging.
Hides any sensitive data as defined by api.config.general.filteredParams
Truncates long strings via api.config.logger.maxLogStringLength
Prepares acton response for logging.
Hides any sensitive data as defined by api.config.general.filteredResponse
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?
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
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
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 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') })
The default log levels are: emerg: 0, alert: 1, crit: 2, error: 3, warning: 4, notice: 5, info: 6, debug: 7
.
Logging levels in winston conform to the severity ordering specified by RFC5424: severity of all levels is assumed to be numerically ascending from most important to least important.
Learn more at https://github.com/winstonjs/winston
Generated using TypeDoc
Utility functions for Actionhero