🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more

nested-query-params

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
n

nested-query-params

Rack like parsing of nested query parameters

1.0.0
73

Supply Chain Security

100

Vulnerability

83

Quality

76

Maintenance

100

License

Version published
Weekly downloads
615
-9.69%
Maintainers
1
Weekly downloads
 
Created
Issues
0

Nested Query Params

A TypeScript implementation of Rack's query string parser.

Overview

A TypeScript implementation of Rack's query string parser. Allows query strings to be expanded into "structural" types; objects, arrays, and string values are supported.

Installation

npm i -D nested-query-params

Usage

import { parseQuery } from "nested-query-params";

// maps
const map = parseQuery("?foo[bar]=baz");
console.debug(map.foo.bar); // prints "baz"

// arrays
const list = parseQuery("?foo[]=bar&foo[]=baz");
console.debug(list.foo); // prints ["bar", "baz"]

// mixed
const mixed = parseQuery("?bar=baz&foo[bar][]=baz&foo[bar][]=42");
console.debug(mixed); // prints { bar: "baz", foo: { bar: ["baz", "42"] } }

FAQs

Package last updated on 11 Mar 2022

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