Version 3.17.2
Show:

QueryString Class

The QueryString module adds support for serializing JavaScript objects into query strings and parsing JavaScript objects from query strings format.

Item Index

Methods

Methods

escape

() static

Provides Y.QueryString.escape method to be able to override default encoding method. This is important in cases where non-standard delimiters are used, if the delimiters would not normally be handled properly by the builtin (en|de)codeURIComponent functions. Default: encodeURIComponent

parse

(
  • qs
  • sep
  • eq
)
public static

Accept Query Strings and return native JavaScript objects.

Parameters:

  • qs String

    Querystring to be parsed into an object.

  • sep String

    (optional) Character that should join param k=v pairs together. Default: "&"

  • eq String

    (optional) Character that should join keys to their values. Default: "="

stringify

(
  • obj
  • cfg
  • name
)
public static

Converts an arbitrary value to a Query String representation.

Objects with cyclical references will trigger an exception.

Parameters:

  • obj Any

    any arbitrary value to convert to query string

  • cfg Object

    (optional) Configuration object. The three supported configurations are:

    • sep: When defined, the value will be used as the key-value separator. The default value is "&".
    • eq: When defined, the value will be used to join the key to the value. The default value is "=".
    • arrayKey: When set to true, the key of an array will have the '[]' notation appended to the key. The default value is false.
  • name String

    (optional) Name of the current key, for handling children recursively.

unescape

(
  • s
)
public static

Provides Y.QueryString.unescape method to be able to override default decoding method. This is important in cases where non-standard delimiters are used, if the delimiters would not normally be handled properly by the builtin (en|de)codeURIComponent functions. Default: replace "+" with " ", and then decodeURIComponent behavior.

Parameters:

  • s String

    String to be decoded.