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

2.0.6 • Public • Published

url-query-parser

A simple script for parsing and manipulating application/x-www-form-urlencoded data (such as the query strings in URLs). Works in both browsers and node.js.

Usage

import Query from 'url-query-parser';
 
let query = new Query('foo=bar&biz=baz');
 
console.log(query.get('foo')); // <= 'bar'

There's a bunch of things it can do. Check out src/query.spec.ts for details.

If instead you just want simple string->object and object->string functions, you can use url-query-parser/simple.

const Query = require('url-query-parser/simple');
 
let query = Query.parse('foo=bar&biz=baz');
console.log(query); // <= { foo: 'bar', biz: 'baz' }
console.log(Query.stringify(query)); // <= 'foo=bar&biz=baz'

Readme

Keywords

none

Package Sidebar

Install

npm i url-query-parser

Weekly Downloads

14

Version

2.0.6

License

MIT

Unpacked Size

28.9 kB

Total Files

9

Last publish

Collaborators

  • larryc5