url-query-updater

1.1.0 • Public • Published

url-query-updater

return a update of the query of url you want to update

install

npm install url-query-updater

how to use

import urlQueryUpdater from "url-query-updater";
 
const updatedQuery = urlQueryUpdater({
    query: { name: "test", where: "nowhere" },
    updates: { name: "updated" }
}); // "name=updated&where=nowhere"
 
const nextUpdatedQuery = urlQueryUpdater({
    query: { name: "noupdate" },
    updates: { address: "nowhere" },
    shouldIncludePrefix: true
}); // "?name=noupdated&address=nowhere"

args

  • query

    a object contains the orginial query

  • updates

    a object contains the queries need to be updated

  • delimiter

    different delimiter than &

  • shouldIncludePrefix

    will include ? at the beginning of the return

Dependencies (0)

    Dev Dependencies (1)

    Package Sidebar

    Install

    npm i url-query-updater

    Weekly Downloads

    4

    Version

    1.1.0

    License

    MIT

    Unpacked Size

    3.14 kB

    Total Files

    4

    Last publish

    Collaborators

    • tiansijie