Skip to content

Latest commit

 

History

History
43 lines (28 loc) · 854 Bytes

README.md

File metadata and controls

43 lines (28 loc) · 854 Bytes

object-to-url-query

Build Status

Convert a javascript object to a url query

installation

npm install object-to-url-query

Usage

ES6

import objectToUrlQuery from 'object-to-url-query';

const objectQuery = {
  name: 'Patrick',
  age: 15,
  skill: 'Software Enginner'
};

const urlQueryString = objectToUrlQuery(objectQuery);

console.log(urlQueryString); //'name=Patrick&age=15&skill=Software%20Enginner'

cjs

var objectToUrlQuery = require('./index');

var objectQuery = {
  name: 'Patrick',
  age: 15,
  skill: 'Software Enginner'
};

var urlQueryString = objectToUrlQuery(objectQuery);

console.log(urlQueryString); //'name=Patrick&age=15&skill=Software%20Enginner'