An interactive command-line interface (CLI) tool to help you install, use, and administer an AO instance.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

20 lines
654 B

// General helper functions
// Returns a random int between min and max (inclusive)
function randomInt(min, max) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min + 1)) + min;
}
// Returns a random item from the given array
export function selectRandom(arrayToChooseFrom) {
return arrayToChooseFrom[randomInt(0, arrayToChooseFrom.length - 1)]
}
// Waits for the given number of milliseconds (or a brief pause by default)
export function sleep(ms = 550) {
return new Promise((r) => setTimeout(r, ms))
}
export const isObject = (obj) => Object.prototype.toString.call(obj) === '[object Object]'