How to use @aws-sdk/querystring-parser - 2 common examples

To help you get started, we’ve selected a few @aws-sdk/querystring-parser 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 aws / aws-sdk-js-v3 / packages / url-parser-browser / src / index.ts View on Github external
export const parseUrl: UrlParser = (url: string): Endpoint => {
  const { hostname, pathname, port, protocol, search } = new URL(url);

  let query: QueryParameterBag | undefined;
  if (search) {
    query = parseQueryString(search);
  }

  return {
    hostname,
    port: port ? parseInt(port) : undefined,
    protocol,
    path: pathname,
    query
  };
};
github aws / aws-sdk-js-v3 / packages / url-parser-node / src / index.ts View on Github external
export const parseUrl: UrlParser = (url: string): Endpoint => {
  const {
    hostname = "localhost",
    pathname = "/",
    port,
    protocol = "https:",
    search
  } = parse(url);

  let query: QueryParameterBag | undefined;
  if (search) {
    query = parseQueryString(search);
  }

  return {
    hostname,
    port: port ? parseInt(port) : undefined,
    protocol,
    path: pathname,
    query
  };
};

@aws-sdk/querystring-parser

[![NPM version](https://img.shields.io/npm/v/@aws-sdk/querystring-parser/latest.svg)](https://www.npmjs.com/package/@aws-sdk/querystring-parser) [![NPM downloads](https://img.shields.io/npm/dm/@aws-sdk/querystring-parser.svg)](https://www.npmjs.com/packag

Apache-2.0
Latest version published 1 year ago

Package Health Score

72 / 100
Full package analysis

Popular @aws-sdk/querystring-parser functions

Similar packages