UNPKG

meilisearch

Version:

The Meilisearch JS client for Node.js and the browser.

20 lines (16 loc) 472 B
async function sleep(ms: number): Promise<void> { return await new Promise((resolve) => setTimeout(resolve, ms)); } function addProtocolIfNotPresent(host: string): string { if (!(host.startsWith("https://") || host.startsWith("http://"))) { return `http://${host}`; } return host; } function addTrailingSlash(url: string): string { if (!url.endsWith("/")) { url += "/"; } return url; } export { sleep, addProtocolIfNotPresent, addTrailingSlash };