UNPKG

@scalar/oas-utils

Version:

Open API spec and Yaml handling utilities

13 lines (10 loc) 306 B
import { REGEX } from './regex-helpers.js'; /** Ensure URL has a protocol prefix */ function ensureProtocol(url) { if (REGEX.PROTOCOL.test(url)) { return url; } // Default to http if no protocol is specified return `http://${url.replace(/^\//, '')}`; } export { ensureProtocol };