Skip to content

anchorjs/querystring

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.