Skip to content
This repository has been archived by the owner on Jan 5, 2021. It is now read-only.

Cyberlane/object-to-querystring

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Version npm

object-to-querystring

Convert an object into a query string.

Example 1

import objectToQuery from 'object-to-querystring';

const params = {
  name: 'Justin',
  number: 12345,
};
const querystring = objectToQuery(params);
/*
 querystring === '?name=Justin&number=12345'
*/

Example 2

import objectToQuery from 'object-to-querystring';

const params = {
  numbers: [5, 10, 15],
};

const querystring = objectToQuery(params);
/*
 querystring === '?numbers=5&numbers=10&numbers=15'
*/

Support

If you find any scenarios that my code does not cover, then create an issue on the GitHub repo, and I will try to fix it ASAP.