Have ideas to improve npm?Join in the discussion! »

    url-param

    1.2.10 • Public • Published

    url-param

    switch between searchStr and paramsObj

    Build Status codecov

    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

    Install

    npm i url-param

    DownloadsWeekly Downloads

    15

    Version

    1.2.10

    License

    MIT

    Unpacked Size

    8.36 kB

    Total Files

    11

    Last publish

    Collaborators

    • avatar