- Source:
Methods
-
(static) combineParams(params, …others)
-
Combines the first params array with the contents of all the others. Duplicate params are pushed into the next param object they do not comflict with. The mutated params array is returned.
Parameters:
Name Type Attributes Description paramsArray An array of param objects othersObject <repeatable>
Any number of param objects - Source:
-
(static) deserializeParams(queryString) → {Array}
-
transforms a query string into an array of param objects (the first occurance of each param will be placed at index 0, the second at index 1, and so on).
Parameters:
Name Type Description queryStringString - Source:
Returns:
params- Type
- Array
Examples
Marbles.QueryParams.deserializeParams("?a=1&b=2&c=3"); //=> [{a: 1, b:2, c:3}]Marbles.QueryParams.deserializeParams("a=1&b=2&c=3"); //=> [{a: 1, b:2, c:3}]Marbles.QueryParams.deserializeParams("?a=1&a=2&b=3&c=4&c=5"); //=> [{a: 1, b:3, c:4}, {a: 2, c: 5}] -
(static) replaceParams(params, …others)
-
Combines the first params array with the contents of all the others. Duplicate params are overwritten if they are at the same params index.
Parameters:
Name Type Attributes Description paramsArray An array of param objects othersObject <repeatable>
Any number of param objects - Source:
-
(static) serializeParams(params)
-
Transforms an array of param objects into a query string.
Parameters:
Name Type Description paramsArray An array of param objects - Source:
Example
Marbles.QueryParams.serializeParams([{a:1, b:2}, {a:3, b:4}]); //= "?a=1&b=2&a=3&b=4"