Files
cloudflare-gateway-pihole-s…/lib/utils.js
T
2023-09-09 21:43:57 +07:00

15 lines
450 B
JavaScript

/**
* Sleeps for a specified amount of time.
* @param {number} [ms=350] The amount of time in ms.
*/
export const sleep = (ms = 350) =>
new Promise((resolve) => setTimeout(resolve, ms));
/**
* Truncates an array to the specified size.
* @param {any[]} arr The array to be truncated.
* @param {number} size The size to which the array will be truncated.
* @returns {any[]}
*/
export const truncateArray = (arr, size) => arr.slice(0, size);