mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-04 09:50:07 +00:00
* Migrate eslint and prettier to biomejs This does NOT include examples/bigbot as it has its own formatter * Update to biome 1.8.0 * Readd dotenv dev dependency to rest During a merge it got lost
17 lines
629 B
TypeScript
17 lines
629 B
TypeScript
/** Pause the execution for a given amount of milliseconds. */
|
|
export async function delay(ms: number): Promise<void> {
|
|
return new Promise(
|
|
(resolve): NodeJS.Timeout =>
|
|
setTimeout((): void => {
|
|
resolve()
|
|
}, ms),
|
|
)
|
|
}
|
|
|
|
// Typescript is not so good as we developers so we need this little utility function to help it out
|
|
// Taken from https://fettblog.eu/typescript-hasownproperty/
|
|
/** TS save way to check if a property exists in an object */
|
|
export function hasProperty<T extends {}, Y extends PropertyKey = string>(obj: T, prop: Y): obj is T & Record<Y, unknown> {
|
|
return obj.hasOwnProperty(prop)
|
|
}
|