query-parsed
TypeScript icon, indicating that this package has built-in type declarations

1.4.0 • Public • Published

query-parsed 🔎

NPM Version Package License NPM Downloads

Blurb

A library for query string type coercion

Installation

npm install query-parsed
yarn add query-parsed

Usage

Parsed

import queryparse from 'query-parsed';

// Return Type = { test: number }
const parsed = queryparse.parse("test=1", { test: Number });

Arrays

import queryparse from 'query-parsed';

// Return Type = { test: number[] }
const parsed = queryparse.parse("test=1,2", { test: [Number] }, { arrayFormat: "comma" });

Typed

import queryparse from 'query-parsed';

// Return Type = { test: string }
const parsed = queryparse.parse<{ test: string }>("test=1");

Default

import queryparse from 'query-parsed';

// Return Type = Record<string, string | string[]>
const parsed = queryparse.parse("test=1");

API

Supported Parse Types

String | Boolean | Number

/query-parsed/

    Package Sidebar

    Install

    npm i query-parsed

    Weekly Downloads

    26

    Version

    1.4.0

    License

    MIT

    Unpacked Size

    6.06 kB

    Total Files

    5

    Last publish

    Collaborators

    • jackall3n