Socket
Socket
Sign inDemoInstall

@types/qs

Package Overview
Dependencies
0
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/qs


Version published
Maintainers
1
Created

Package description

What is @types/qs?

The @types/qs package provides TypeScript type definitions for the qs library, which is used for parsing and stringifying query strings. It allows developers to work with query strings in a type-safe manner, ensuring that the code adheres to the expected structure and types of the qs library.

What are @types/qs's main functionalities?

Parsing query strings

This feature allows you to parse query strings into an object, making it easier to access the query parameters.

import * as qs from 'qs';

const query = '?a=c&b=d';
const parsed = qs.parse(query);
console.log(parsed); // { a: 'c', b: 'd' }

Stringifying objects

This feature enables you to convert an object into a query string, useful for creating URLs with query parameters.

import * as qs from 'qs';

const obj = { a: 'c', b: 'd' };
const stringified = qs.stringify(obj);
console.log(stringified); // 'a=c&b=d'

Other packages similar to @types/qs

Readme

Source

Installation

npm install --save @types/qs

Summary

This package contains type definitions for qs (https://github.com/ljharb/qs).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/qs.

index.d.ts

export = QueryString;
export as namespace qs;

declare namespace QueryString {
    type defaultEncoder = (str: any, defaultEncoder?: any, charset?: string) => string;
    type defaultDecoder = (str: string, decoder?: any, charset?: string) => string;

    interface IStringifyOptions {
        delimiter?: string | undefined;
        strictNullHandling?: boolean | undefined;
        skipNulls?: boolean | undefined;
        encode?: boolean | undefined;
        encoder?:
            | ((str: any, defaultEncoder: defaultEncoder, charset: string, type: "key" | "value") => string)
            | undefined;
        filter?: Array<string | number> | ((prefix: string, value: any) => any) | undefined;
        arrayFormat?: "indices" | "brackets" | "repeat" | "comma" | undefined;
        indices?: boolean | undefined;
        sort?: ((a: any, b: any) => number) | undefined;
        serializeDate?: ((d: Date) => string) | undefined;
        format?: "RFC1738" | "RFC3986" | undefined;
        encodeValuesOnly?: boolean | undefined;
        addQueryPrefix?: boolean | undefined;
        allowDots?: boolean | undefined;
        charset?: "utf-8" | "iso-8859-1" | undefined;
        charsetSentinel?: boolean | undefined;
    }

    interface IParseOptions {
        comma?: boolean | undefined;
        delimiter?: string | RegExp | undefined;
        depth?: number | false | undefined;
        decoder?:
            | ((str: string, defaultDecoder: defaultDecoder, charset: string, type: "key" | "value") => any)
            | undefined;
        arrayLimit?: number | undefined;
        parseArrays?: boolean | undefined;
        allowDots?: boolean | undefined;
        plainObjects?: boolean | undefined;
        allowPrototypes?: boolean | undefined;
        parameterLimit?: number | undefined;
        strictNullHandling?: boolean | undefined;
        ignoreQueryPrefix?: boolean | undefined;
        charset?: "utf-8" | "iso-8859-1" | undefined;
        charsetSentinel?: boolean | undefined;
        interpretNumericEntities?: boolean | undefined;
    }

    interface ParsedQs {
        [key: string]: undefined | string | string[] | ParsedQs | ParsedQs[];
    }

    function stringify(obj: any, options?: IStringifyOptions): string;
    function parse(str: string, options?: IParseOptions & { decoder?: never | undefined }): ParsedQs;
    function parse(str: string | Record<string, string>, options?: IParseOptions): { [key: string]: unknown };
}

Additional Details

  • Last updated: Wed, 18 Oct 2023 05:47:09 GMT
  • Dependencies: none

Credits

These definitions were written by Roman Korneev, Leon Yu, Belinda Teh, Melvin Lee, Arturs Vonda, Carlos Bonetti, Dan Smith, Hunter Perrin, and Jordan Harband.

FAQs

Last updated on 18 Oct 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc