How to use the normalize-url.default function in normalize-url

To help you get started, we’ve selected a few normalize-url examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microsoft / BotFramework-Composer / Composer / packages / lib / code-editor / src / utils / lspUtil.ts View on Github external
export function createUrl(server: { [key: string]: string | number | undefined } | string): string {
  if (typeof server === 'string') {
    return normalizeUrl.default(server).replace(/^http/, 'ws');
  }
  const { host, hostname = location.hostname, port = location.port, path = '/', basePath = '' } = server;
  const protocol = location.protocol === 'https:' ? 'wss' : 'ws';
  const endHost = host || `${hostname}:${port}`;
  return normalizeUrl.default(`${protocol}://${endHost}/${basePath}/${path}`);
}
github microsoft / BotFramework-Composer / Composer / packages / lib / code-editor / src / utils / lspUtil.ts View on Github external
export function createUrl(server: { [key: string]: string | number | undefined } | string): string {
  if (typeof server === 'string') {
    return normalizeUrl.default(server).replace(/^http/, 'ws');
  }
  const { host, hostname = location.hostname, port = location.port, path = '/', basePath = '' } = server;
  const protocol = location.protocol === 'https:' ? 'wss' : 'ws';
  const endHost = host || `${hostname}:${port}`;
  return normalizeUrl.default(`${protocol}://${endHost}/${basePath}/${path}`);
}

normalize-url

Normalize a URL

MIT
Latest version published 9 months ago

Package Health Score

77 / 100
Full package analysis

Popular normalize-url functions