0.0.3 • Published 1 year ago

@oc-shopaholic/url-generation v0.0.3

Weekly downloads
-
License
GPL-3.0-or-later
Repository
github
Last release
1 year ago

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.