toParams()

Takes an object and turns it into a serialized URL parameter string.

This function is valid in v2.22.0 to v2.24.3. This function has been downloaded 37 times.

Parameters

{Object} obj
The object to be serialized as a URL parameter string.
{Function=} opt_formatter Optional
Optional formatter function. Used to format the values that will be displayed for each value from obj. For each value found in obj this function will be passed (1) the value and (2) the path to that value as an array. The return value will be used as the value added to the serialized string. If undefined is returned or if nothing is returned then nothing will be added to the parameter serialization for that object property.

Returns

{string}
A URL parameter string representing obj.

Required Functions

This function directly requires the following functions which are included automatically:

  • escape()
    Encodes a string to be used in a query part of a URL.
  • flattenKeys()
    Creates a new object with keys to all of the values regardless of the level(excluding recursive objects). Keys for values on deeper levels will be joined by a "." while any dots or backslashes in the original keys will be escaped with a leading blackslash.
  • has()
    Every object descended from Object inherits the hasOwnProperty method. This method can be used to determine whether an object has the specified property as a direct property of that object; unlike the in operator, this method does not check down the object's prototype chain.
  • nativeType()
    Gets the native type name of a primitive or an object. Unlike YourJS.typeOf(), the types are solely determined by the system.