From 3a06919029c371b8e9b53bb7cef3963431e47636 Mon Sep 17 00:00:00 2001 From: Sadzurami <47674424+Sadzurami@users.noreply.github.com> Date: Sat, 17 Aug 2024 14:10:10 +0300 Subject: [PATCH] Use built-in delay method (#2373) --- source/create.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/source/create.ts b/source/create.ts index 46ea7501d..1a679569b 100644 --- a/source/create.ts +++ b/source/create.ts @@ -1,3 +1,4 @@ +import {setTimeout as delay} from 'node:timers/promises'; import is, {assert} from '@sindresorhus/is'; import asPromise from './as-promise/index.js'; import type { @@ -17,11 +18,6 @@ import type {Response} from './core/response.js'; import Options, {type OptionsInit} from './core/options.js'; import type {CancelableRequest} from './as-promise/types.js'; -// The `delay` package weighs 10KB (!) -const delay = async (ms: number) => new Promise(resolve => { - setTimeout(resolve, ms); -}); - const isGotInstance = (value: Got | ExtendOptions): value is Got => is.function(value); const aliases: readonly HTTPAlias[] = [