1.1.5 • Published 6 years ago

jquerydeparam v1.1.5

Weekly downloads
5
License
MIT
Repository
github
Last release
6 years ago

JQuery deparam

JQuery deparam is a lightweight plugin that converts querystring to a JavaScript object

Installation

npm install --save jquerydeparam

Usage

ES6

import deparam from 'jquerydeparam';
deparam(...);

CommonJS

const deparam = require('jquerydeparam');
deparam(...);

Browser

deparam(...);

As JQuery plugin

import $ from 'jquery';
import 'jquerydeparam';
$.deparam(...);

Note: JQuery deparam is dependent on jquery. Therefore, if the package throws an error, you know what to do!

How it works?

Deparam converts simple and complex query strings into JavaScript objects. Examples are shown below:

#1 Simple query

var query = "key1=value1&key2=value2";
console.log(deparam(query));

Result:

{
    key1: "value1",
    key2: "value2"
}

#2 Complex query

var query = "flag=true&arr[]=Hello&arr[]=World&ob[key1]=value1&ob[key2]=value2";
console.log(deparam(query));

Result:

{
    flag: true,
    arr: [
        "Hello",
        "World"
    ],
    ob: {
        key1: "value1",
        key2: "value2"
    }
}
1.1.5

6 years ago

1.1.4

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago

0.1.1

8 years ago

0.1.0

8 years ago