Sign In

@standardserver/shared

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@standardserver/shared - npm Package Compare versions

Comparing version
0.0.6
to
0.0.7
+6
-3
dist/index.d.mts
declare function toArray<T>(value: T): T extends readonly any[] ? T : Exclude<T, undefined | null>[];
declare const PACKAGE_NAME = "@standardserver/shared";
declare const PACKAGE_VERSION = "0.0.6";
declare const PACKAGE_VERSION = "0.0.7";
/**

@@ -109,6 +109,9 @@ * Generates a unique symbol for the specified name within the package scope.

interface SleepOptions {
signal?: AbortSignal | undefined;
}
/**
* sleep for a specified amount of time
*/
declare function sleep(ms: number): Promise<void>;
declare function sleep(ms: number, { signal }?: SleepOptions): Promise<void>;

@@ -118,2 +121,2 @@ declare function tryDecodeURIComponent(value: string): string;

export { AbortError, AsyncIdQueue, AsyncIteratorClass, PACKAGE_NAME, PACKAGE_VERSION, SequentialIdGenerator, getOrBind, getPackageSymbol, isAsyncIteratorObject, isTypescriptObject, parseEmptyableJSON, sequential, sleep, stringifyJSON, toArray, tryDecodeURIComponent };
export type { AsyncCleanupFn, AsyncIdQueueCloseOptions, AsyncIdQueueOptions, AsyncIteratorClassNextFn, GetOrBindOptions };
export type { AsyncCleanupFn, AsyncIdQueueCloseOptions, AsyncIdQueueOptions, AsyncIteratorClassNextFn, GetOrBindOptions, SleepOptions };
declare function toArray<T>(value: T): T extends readonly any[] ? T : Exclude<T, undefined | null>[];
declare const PACKAGE_NAME = "@standardserver/shared";
declare const PACKAGE_VERSION = "0.0.6";
declare const PACKAGE_VERSION = "0.0.7";
/**

@@ -109,6 +109,9 @@ * Generates a unique symbol for the specified name within the package scope.

interface SleepOptions {
signal?: AbortSignal | undefined;
}
/**
* sleep for a specified amount of time
*/
declare function sleep(ms: number): Promise<void>;
declare function sleep(ms: number, { signal }?: SleepOptions): Promise<void>;

@@ -118,2 +121,2 @@ declare function tryDecodeURIComponent(value: string): string;

export { AbortError, AsyncIdQueue, AsyncIteratorClass, PACKAGE_NAME, PACKAGE_VERSION, SequentialIdGenerator, getOrBind, getPackageSymbol, isAsyncIteratorObject, isTypescriptObject, parseEmptyableJSON, sequential, sleep, stringifyJSON, toArray, tryDecodeURIComponent };
export type { AsyncCleanupFn, AsyncIdQueueCloseOptions, AsyncIdQueueOptions, AsyncIteratorClassNextFn, GetOrBindOptions };
export type { AsyncCleanupFn, AsyncIdQueueCloseOptions, AsyncIdQueueOptions, AsyncIteratorClassNextFn, GetOrBindOptions, SleepOptions };

@@ -6,3 +6,3 @@ function toArray(value) {

const PACKAGE_NAME = "@standardserver/shared";
const PACKAGE_VERSION = "0.0.6";
const PACKAGE_VERSION = "0.0.7";
function getPackageSymbol(name) {

@@ -230,4 +230,22 @@ return Symbol.for(`${PACKAGE_NAME}@${PACKAGE_VERSION}/${name}`);

function sleep(ms) {
return new Promise((resolve) => setTimeout(resolve, ms));
function sleep(ms, { signal } = {}) {
return new Promise((resolve, reject) => {
if (signal?.aborted) {
reject(signal.reason);
return;
}
let abortListener = null;
const timeout = setTimeout(() => {
if (abortListener) {
signal?.removeEventListener("abort", abortListener);
}
resolve();
}, ms);
if (signal) {
signal.addEventListener("abort", abortListener = () => {
clearTimeout(timeout);
reject(signal?.reason);
}, { once: true });
}
});
}

@@ -234,0 +252,0 @@

{
"name": "@standardserver/shared",
"type": "module",
"version": "0.0.6",
"version": "0.0.7",
"license": "MIT",

@@ -6,0 +6,0 @@ "homepage": "https://standardserver.dev",