Javascript tools
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Javascript utilities.

So far, just the excellent QueryString lib by Jan Wolter, with a few modifications by Tim McCormack. Documentation is at top of file and as JSDoc on functions.


Read and write querystrings while preserving pair order, multiply-occurring keys, missing vs. empty vals, and original encoding. The QueryString object is immutable and presents a builder API to make reasoning about your code as easy as possible.

// On page with querystring ??a=b&foo=bar&blank=&foo=baz&missing&&&
>>> var qs = new QueryString(); // == new QueryString(
>>> qs.values('foo')
["bar", "baz"]
>>> qs.pairs()
[["?a", "b"], ["foo", "bar"], ["blank", ""], ["foo", "baz"], ["missing", null]]

// Build and serialize
>>> var base ="format", "html").plus("=a=", "");
>>> base.toString()

// Immutable
>>> var altered = base.minus('=a=');
>>> altered.toString()
>>> base.value('=a=')