Converts keyValuePairs
to a URI-encoded query string and returns it.
Performs the reverse of getURLQuery()
.
Decodes urlQuery
and returns it as an object of key-value pairs.
let urlQuery = getURLQuery(
{name:'joe schmoe', email:'[email protected]', password:'&Å͆'}
);
// urlQuery === '?name=joe%20schmoe&email=jschmoe%40gmail.com&password=%26%C3%85%C3%8D%E2%80%A0'
// You can decode the information by passing it to getObjectFromURLQuery():
getObjectFromURLQuery(urlQuery);
// --> { name: 'joe schmoe', email: '[email protected]', password: '&Å͆' }
npm i @writetome51/get-url-query
import {getURLQuery, getObjectFromURLQuery} from '@writetome51/get-url-query';