Skip to content

Latest commit

 

History

History
78 lines (48 loc) · 1.72 KB

README.md

File metadata and controls

78 lines (48 loc) · 1.72 KB

Anchor/Query String

The query string module provides utilities for dealing with query strings.

Install

component
$ component install anchorjs/querystring
volo
$ volo add anchorjs/querystring

Usage

Stringify

Serialize an object to a query string. Optionally override the default separator ('&') and assignment ('=') characters.

querystring.stringify({ foo: 'bar', baz: ['qux', 'quux'], corge: '' })
// returns
'foo=bar&baz=qux&baz=quux&corge='

querystring.stringify({foo: 'bar', baz: 'qux'}, ';', ':')
// returns
'foo:bar;baz:qux'

Parse

Deserialize a query string to an object. Optionally override the default separator ('&') and assignment ('=') characters.

querystring.parse('foo=bar&baz=qux&baz=quux&corge')
// returns
{ foo: 'bar', baz: ['qux', 'quux'], corge: '' }

Compatibility

component

This module uses the AMD format. To include in component builds, use component-amd:

component build -u component-amd
Node

This module implements the interface exported by Node's Query String module.

Tests

To run tests in a browser, execute the Make target for the desired browser:

$ make test-chrome
$ make test-firefox
$ make test-safari

Headless tests can be executed directly from a terminal:

$ make test-phantomjs

Credits

License

The MIT License

Copyright (c) 2012-2013 Jared Hanson <http://jaredhanson.net/>
Copyright Joyent, Inc. and other Node contributors.