UNPKG

567 BJavaScriptView Raw
1/**
2 * react-router v8.0.0
3 *
4 * Copyright (c) Remix Software Inc.
5 *
6 * This source code is licensed under the MIT license found in the
7 * LICENSE.md file in the root directory of this source tree.
8 *
9 * @license MIT
10 */
11//#region lib/router/url.ts
12const ABSOLUTE_URL_REGEX = /^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i;
13const PROTOCOL_RELATIVE_URL_REGEX = /^[\\/]{2}/;
14function normalizeProtocolRelativeUrl(url, protocol) {
15 return protocol + url.replace(/\\/g, "/");
16}
17//#endregion
18export { ABSOLUTE_URL_REGEX, PROTOCOL_RELATIVE_URL_REGEX, normalizeProtocolRelativeUrl };