joshghent / query-stringifier

:question: A small library for build query strings
https://joshghent.github.io/query-stringifier/
MIT License
2 stars 2 forks source link
node npm parse query query-stringifier

Query-Stringifier Build Status npm version Greenkeeper badge devDependencies

A small library for build query strings

Install

$ npm install query-stringifier

Usage


const qs = require('query-stringifier');

const params = {
    food: 'pizza',
    bar: 'chocolate'
}

qs.stringify(params);
// 'food=pizza&bar=chocolate'

// Also add options!

const options = { prefix: '?' };

qs.stringify(params, options);
// '?food=pizza&bar=chocolate'

// Parse query strings into objects
qs.parse('?food=pizza&bar=chocolate');
// { food: pizza, bar: chocolate }

// Extract query string from url
qs.extract('http://test.com?food=pizza&bar=chocolate');
// food=pizza&bar=chocolate

Tests

$ npm test
$ npm run test:coverage

Documentation

You have a look at the documentation here.

If you ever edit the documentation and wants to generate a new version of it just run the command:

$ npm run docs

Commit your changes and push them to master. Github pages will update the page automatically.

Issues?

Go here

Contributing

Insterested to help? Just follow our Contribution Guide.