How to use parse-url - 9 common examples

To help you get started, we’ve selected a few parse-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 dividedbyzeroco / warp-server / src / adapters / database / mysql / client.ts View on Github external
private extractConfig(uri: string) {
        const parsedURI = parseUrl(uri);
        const identity = parsedURI.user.split(':');

        // Get params
        const params = parsedURI.query;

        const config = {
            protocol: parsedURI.protocol,
            host: parsedURI.resource,
            port: parsedURI.port,
            user: decodeURIComponent(identity[0]),
            password: decodeURIComponent(identity[1]),
            database: parsedURI.pathname.slice(1),
            ...params,
        };

        // Enforce
github dividedbyzeroco / warp-server / src / index.ts View on Github external
private _extractDatabaseConfig(databaseURI: string) {
        const parsedURI = parseUrl(databaseURI);
        const identity = parsedURI.user.split(':');

        return {
            protocol: parsedURI.protocol,
            host: parsedURI.resource,
            port: parsedURI.port,
            user: identity[0],
            password: identity[1],
            schema: parsedURI.pathname.slice(1)
        };
    }
github zeit / hyper / lib / actions / ui.ts View on Github external
effect() {
        const parsedUrl = parseUrl(url, true);
        let command = parsedUrl.protocol + ' ' + (parsedUrl.user ? `${parsedUrl.user}@` : '') + parsedUrl.resource;

        if (parsedUrl.port) command += ' -p ' + parsedUrl.port;

        command += '\n';

        rpc.once('session add', ({uid}) => {
          rpc.once('session data', () => {
            dispatch(sendSessionData(uid, command, null));
          });
        });

        dispatch(requestSession());
      }
    });
github devlucky / Kakapo.js / src / interceptors / interceptorHelper.js View on Github external
getQuery(url) {
    return queryString.parse(parseUrl(url).search);
  }
});
github devlucky / Kakapo.js / src / interceptors / baseInterceptor.js View on Github external
const extractUrl = (url, method) => ({
    handlers: routes[method],
    pathname: parseUrl(url).pathname,
    fullpath: parseUrl(url).href,
  });
github devlucky / Kakapo.js / src / interceptors / baseInterceptor.js View on Github external
const extractUrl = (url, method) => ({
    handlers: routes[method],
    pathname: parseUrl(url).pathname,
    fullpath: parseUrl(url).href,
  });
github devlucky / Kakapo.js / src / interceptors / interceptorHelper.js View on Github external
const extractUrl = (
  { routes }: InterceptorConfig,
  url: string,
  method: string
) => ({
  handlers: routes[method],
  pathname: parseUrl(url).pathname,
  fullpath: parseUrl(url).href
});
github devlucky / Kakapo.js / src / interceptors / interceptorHelper.js View on Github external
const extractUrl = (
  { routes }: InterceptorConfig,
  url: string,
  method: string
) => ({
  handlers: routes[method],
  pathname: parseUrl(url).pathname,
  fullpath: parseUrl(url).href
});
github devlucky / Kakapo.js / src / interceptors / baseInterceptor.js View on Github external
export const getQuery = (url) => queryString.parse(parseUrl(url).search);

parse-url

An advanced url parser supporting git urls too.

MIT
Latest version published 3 months ago

Package Health Score

88 / 100
Full package analysis

Popular parse-url functions