@lovata/url-generation

    1.0.0 • Public • Published

    URL generation package

    installation

    npm install @lovata/url-generation

    Basic usage

    import UrlGeneration from "@lovata/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 "@lovata/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 "@lovata/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 "@lovata/url-generation";
    
    //URL http:://site.com?page=1&sorting=popularity|desc&brand=apple|samsung
    UrlGeneration.init();
    UrlGeneration.clear();
    
    //URL http:://site.com

    License

    © 2019, LOVATA Group, LLC under GNU GPL v3.

    Developed by Andrey Kharanenka.

    Install

    npm i @lovata/url-generation

    DownloadsWeekly Downloads

    32

    Version

    1.0.0

    License

    GPL-3.0-or-later

    Unpacked Size

    39.2 kB

    Total Files

    4

    Last publish

    Collaborators

    • lautsevich
    • andrey_kharanenka