@writetome51/get-url-query
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

getURLQuery(
      keyValuePairs: object
): string

Converts keyValuePairs to a URI-encoded query string and returns it.

getObjectFromURLQuery(
      urlQuery: string
): object

Performs the reverse of getURLQuery().
Decodes urlQuery and returns it as an object of key-value pairs.

Examples

let urlQuery = getURLQuery(
	{name:'joe schmoe', email:'jschmoe@gmail.com', 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: 'jschmoe@gmail.com', password: '&Å͆' }

Installation

npm i  @writetome51/get-url-query

Loading

import {getURLQuery, getObjectFromURLQuery} from '@writetome51/get-url-query';

Package Sidebar

Install

npm i @writetome51/get-url-query

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

4.7 kB

Total Files

5

Last publish

Collaborators

  • writetome51