Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add documentation for querystring module.

  • Loading branch information...
commit 224d1bdfd4b111f3203341695648ccb81ee72feb 1 parent ddf8b6b
@Gozala authored
Showing with 37 additions and 0 deletions.
  1. +37 −0 packages/api-utils/docs/querystring.md
View
37 packages/api-utils/docs/querystring.md
@@ -0,0 +1,37 @@
+<!-- This Source Code Form is subject to the terms of the Mozilla Public
+ - License, v. 2.0. If a copy of the MPL was not distributed with this
+ - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
+
+Module exports utility functions for working with query strings.
+
+### stringify
+
+Object may be serialize to a query string via exported `stringify` function:
+
+ querystring.stringify({ foo: 'bar', baz: 4 }); // => 'foo=bar&baz=4'
+
+Optionally `separator` and `assignment` arguments may be passed to
+override default `'&'` and`'='` characters:
+
+ querystring.stringify({ foo: 'bar', baz: 4 }, ';', ':'); // => 'foo:bar;baz:4'
+
+### parse
+
+Query string may be deserialized to an object via exported `parse`
+function:
+
+ querystring.parse('foo=bar&baz=bla') // => { foo: 'bar', baz: 'bla' }
+
+Optionally `separator` and `assignment` arguments may be passed to
+override default `'&'` and `'='` characters:
+
+ querystring.parse('foo:bar|baz:bla', '|', ':') // => { foo: 'bar', baz: 'bla' }
+
+### escape
+
+The escape function used by `stringify` to encodes a string safely
+matching RFC 3986 for `application/x-www-form-urlencoded`.
+
+### unescape
+
+The unescape function used by `parse` to decode a string safely.
Please sign in to comment.
Something went wrong with that request. Please try again.