@syncmarket/utils
v1.0.0
Published
Utilities for syncmarket scrapper
Downloads
3
Readme
@syncmarket/utils
Utilidades disponibles
isHTTPUrl
Comprueba si una URL es válida.
Uso
import { isHTTPUrl } from '@syncmarket/utils'
const HTTP_URL = 'http://example.com'
const HTTPS_URL = 'https://example.com'
const MAIL_URL = 'mailto://[email protected]'
isHTTPUrl(HTTP_URL) // true
isHTTPUrl(HTTPS_URL) // true
isHTTPUrl(MAIL_URL) // false
isHTTPUrl('hola') // false
sleep
Esta utilidad es para agregar un tiempo de espera antes de continuar con el resto del código.
Uso
import { sleep } from '@syncmarket/utils'
const THREE_SECONDS_DELAY = 3000
console.log('hola')
await sleep(THREE_SECONDS_DELAY)
console.log('world')