@magic-libraries/uri

@magic-libraries/uri

@magic-client library.

@magic-libraries/uri encodes objects to uri strings and uri strings to objects.

installation

npm install --save-exact @magic-libraries/uri

usage

in a page/component, just use the lib.uri functions

encode

lib.uri.encode({  host: 'https://example.com',  params: {    param_1: true,    param_2: 'string',  },})

returns

https://example.com?param_1=true&param_2=string

decode

const uri = 'https://example.com/?param_1=true&param_2=string'lib.uri.decode(uri)

returns

{  host: 'https://example.com',  params: {    param_1: true,    param_2: 'string',  },}

source

the source for this page is in the example directory and gets built and published to github using @magic/core