-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* doesn't quite fix #13, but typedoc is showing no export errors now * fixing typing when this package is complied with another dependency which would be needed * moved unit test functions back into its own file
- Loading branch information
Showing
16 changed files
with
199 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import EventEmitter from 'node:events' | ||
|
||
|
||
/** @internal */ | ||
export const sleep = async (ms: number): Promise<unknown> => { | ||
return await new Promise(resolve => setTimeout(resolve, ms)) | ||
} | ||
|
||
/** @internal */ | ||
export const expectEvent = async <T=any>(emitter: EventEmitter, name: string | symbol): Promise<T> => { | ||
return await new Promise<T>((resolve) => { emitter.once(name, resolve) }) | ||
} | ||
|
||
|
||
/** @internal */ | ||
export interface Deferred<T=any> { | ||
resolve: (value: T | PromiseLike<T>) => void | ||
reject: (reason?: any) => void | ||
promise: Promise<T> | ||
} | ||
|
||
/** @internal */ | ||
export const createDeferred = <T=any>(noUncaught?: boolean): Deferred<T> => { | ||
const dfd: any = {} | ||
dfd.promise = new Promise((resolve, reject) => { | ||
dfd.resolve = resolve | ||
dfd.reject = reject | ||
}) | ||
/* istanbul ignore next */ | ||
if (noUncaught === false) { | ||
dfd.promise.catch(() => {}) | ||
} | ||
return dfd | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
/** @internal */ | ||
/** | ||
* Node | ||
* @since 1.0.0 | ||
*/ | ||
export interface Node { | ||
name: string | ||
length: number | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.