mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 12:10:49 +00:00
Add type information for new functions.
This commit is contained in:
parent
be6a6dccd9
commit
932ea6b8f9
3 changed files with 14 additions and 3 deletions
|
|
@ -8,6 +8,9 @@ import {
|
|||
LOGGING_VERBOSE,
|
||||
} from "../config/settings.js";
|
||||
|
||||
/**
|
||||
* @type {{ bufferOutput: boolean, bufferedMessages:(() => void)[]}}
|
||||
*/
|
||||
const state = {
|
||||
bufferOutput: false,
|
||||
bufferedMessages: [],
|
||||
|
|
@ -72,12 +75,21 @@ function writeExitWithoutInstallingMaliciousPackages() {
|
|||
writeOrBuffer(() => console.error(message));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} message
|
||||
* @param {...any} optionalParams
|
||||
* @returns {void}
|
||||
*/
|
||||
function writeVerbose(message, ...optionalParams) {
|
||||
if (!isVerboseMode()) return;
|
||||
|
||||
writeOrBuffer(() => console.log(message, ...optionalParams));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {() => void} messageFunction
|
||||
*/
|
||||
function writeOrBuffer(messageFunction) {
|
||||
if (state.bufferOutput) {
|
||||
state.bufferedMessages.push(messageFunction);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue