初始化环境文件

This commit is contained in:
CN-JS-HuiBai
2026-04-04 12:49:09 +08:00
parent 07742d2688
commit c607af6fac
5971 changed files with 515160 additions and 18 deletions

View File

@@ -0,0 +1,2 @@
export * from "./sleep";
export * from "./validate";

View File

@@ -0,0 +1,3 @@
export const sleep = (seconds) => {
return new Promise((resolve) => setTimeout(resolve, seconds * 1000));
};

View File

@@ -0,0 +1,17 @@
export const validateWaiterOptions = (options) => {
if (options.maxWaitTime <= 0) {
throw new Error(`WaiterConfiguration.maxWaitTime must be greater than 0`);
}
else if (options.minDelay <= 0) {
throw new Error(`WaiterConfiguration.minDelay must be greater than 0`);
}
else if (options.maxDelay <= 0) {
throw new Error(`WaiterConfiguration.maxDelay must be greater than 0`);
}
else if (options.maxWaitTime <= options.minDelay) {
throw new Error(`WaiterConfiguration.maxWaitTime [${options.maxWaitTime}] must be greater than WaiterConfiguration.minDelay [${options.minDelay}] for this waiter`);
}
else if (options.maxDelay < options.minDelay) {
throw new Error(`WaiterConfiguration.maxDelay [${options.maxDelay}] must be greater than WaiterConfiguration.minDelay [${options.minDelay}] for this waiter`);
}
};