url-param
v1.2.10
Published
switch between searchStr and paramsObj
Downloads
49
Maintainers
Readme
url-param
switch between searchStr and paramsObj
install
$ npm install url-param
import
import { u } from 'url-param'
usage
paramsObj <=> searchStr
const searchStr = u({ q: '⭐' })
// => '?q=%E2%AD%90'
const paramsObj = u('?q=%E2%AD%90')
// => {q: "⭐"}
const urlObj = u('https://www.google.com/search?q=%E2%AD%90')
// => {q: "⭐"}
for current location.search
// say `location.search` is '?a=%21&%CE%B2=2'
u() // => {a: "!", β: "2"}
u('a') // => '!'
u().β // => '2'
u()['β'] // => '2'
License
MIT