search-params

  • Version 4.0.1
  • Published
  • 61.9 kB
  • No dependencies
  • MIT license

Install

npm i search-params
yarn add search-params
pnpm add search-params

Overview

A module to manipulate search part of URLs (querystring)

Index

Functions

function build

build: <
T extends Record<string, any> = Record<
string,
string | boolean | (string | boolean)[]
>
>(
params: T,
opts?: IOptions | undefined
) => string;
  • Build a querystring from an object of parameters

function keep

keep: (
path: string,
paramsToKeep: string[],
opts?: IOptions | undefined
) => IKeepResponse;
  • Remove a list of parameters from a querystring

function omit

omit: (
path: string,
paramsToOmit: string[],
opts?: IOptions | undefined
) => IOmitResponse;
  • Remove a list of parameters from a querystring

function parse

parse: <
T extends Record<string, any> = Record<
string,
string | boolean | (string | boolean)[]
>
>(
path: string,
opts?: IOptions | undefined
) => T;
  • Parse a querystring and return an object of parameters

Interfaces

interface IKeepResponse

interface IKeepResponse {}

    property keptParams

    keptParams: object;

      property querystring

      querystring: string;

        interface IOmitResponse

        interface IOmitResponse {}

          property querystring

          querystring: string;

            property removedParams

            removedParams: object;

              interface IOptions

              interface IOptions {}

                property arrayFormat

                arrayFormat?: arrayFormat;

                  property booleanFormat

                  booleanFormat?: booleanFormat;

                    property nullFormat

                    nullFormat?: nullFormat;

                      Type Aliases

                      type SearchParams

                      type SearchParams = Record<
                      string,
                      string | boolean | null | Array<string | boolean | null> | undefined
                      >;

                        Package Files (2)

                        Dependencies (0)

                        No dependencies.

                        Dev Dependencies (6)

                        Peer Dependencies (0)

                        No peer dependencies.

                        Badge

                        To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                        You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/search-params.

                        • Markdown
                          [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/search-params)
                        • HTML
                          <a href="https://www.jsdocs.io/package/search-params"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>