queri.js
Parse, stringify and manage your URI queries.
Library does not operates with window.location or pushState, if you need to - you got to do it yourself.
queri.js supports HTTP Queries of any nesting, according it's RFC
Usage
- Include Queri.js
You can include module viarequire('queri');
in NodeJS
Or you can link Queri.js directly to your page via<script src="queri.js"></script>
IMPORTANT!Queri
class will be available as a global variable - Enjoy
Use Queri.js whatever you like to
let q = 'foo=bar&bar[]=1&bar[]=2&bar[]=3&baz=bat';q; // ->> barq; // ->> [1, 2, 3] q ; // ->> 'foo=bar&baz=bat' qquery = 'a=b&c=d';q; // ->> falseq; // ->> {a: "b", c: "d"}qquery; // ->> {a: "b", c: "d"} q ; // ->> a=b q ; // ->> "" a: "b" c: "d" === 'a=b&c=d';
Doc
.query
property, object representing current query
constructor ( input = {} )
method, returns new Queri object
get ( key = null, defaultValue = null )
method, returns .query[key]
or default value if first one not presented, or whole .query
if key is null
set ( key, val )
method, returns self
remove ( key = null )
method, returns self
stringify ( )
method, returns stringified version of .query