reorganized code

This commit is contained in:
Viet Huynh
2023-09-09 21:43:57 +07:00
parent 61d6c03704
commit ed5f24b6ec
3 changed files with 21 additions and 24 deletions
+8
View File
@@ -4,3 +4,11 @@
*/
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);