@oc-shopaholic/url-generation

0.0.3 • Public • Published

URL generation package

installation

npm install @oc-shopaholic/url-generation

Basic usage

import UrlGeneration from "@oc-shopaholic/url-generation";

UrlGeneration.init();
UrlGeneration.remove('page');
UrlGeneration.set('sorting', 'popularity|desc');

UrlGeneration.update();

Methods

set(sFiled, obValue)

Add field value in search string For example:

import UrlGeneration from "@oc-shopaholic/url-generation";

//URL http:://site.com?page=1
UrlGeneration.init();
UrlGeneration.set('sorting', 'popularity|desc');
UrlGeneration.update();

//URL http:://site.com?page=1&sorting=popularity|desc

UrlGeneration.set('brand', ['apple', 'samsung']);
UrlGeneration.update();
//URL http:://site.com?page=1&sorting=popularity|desc&brand=apple|samsung

remove(sFiled)

Remove field value from search string For example:

import UrlGeneration from "@oc-shopaholic/url-generation";

//URL http:://site.com?page=1&sorting=popularity|desc&brand=apple|samsung
UrlGeneration.init();
UrlGeneration.set('brand');
UrlGeneration.update();

//URL http:://site.com?page=1&sorting=popularity|desc

clear()

Clear search string. For example:

import UrlGeneration from "@oc-shopaholic/url-generation";

//URL http:://site.com?page=1&sorting=popularity|desc&brand=apple|samsung
UrlGeneration.init();
UrlGeneration.clear();

//URL http:://site.com

License

© 2024, oc-shopaholic under GNU GPL v3.

Developed by Andrei Kharanenka.

/@oc-shopaholic/url-generation/

    Package Sidebar

    Install

    npm i @oc-shopaholic/url-generation

    Weekly Downloads

    1

    Version

    0.0.3

    License

    GPL-3.0-or-later

    Unpacked Size

    38.7 kB

    Total Files

    4

    Last publish

    Collaborators

    • lautsevich
    • sakalou
    • andrey_kharanenka