Q.String Class
Q extended methods for Strings
Item Index
Methods
bind
-
method
-
obj
-
options
Binds a method to an object, so "this" inside the method refers to that object when it is called.
decodeHTML
-
[convert]
Reverses what encodeHTML does
Parameters:
-
[convert]
Array optionalArray of codes to unconvert. Can include '&', '<', '>, '"', ''', "
", "
"
Returns:
encodeHTML
-
[convert]
Returns a copy of the string with special HTML characters escaped
Parameters:
-
[convert]
Array optionalArray of characters to convert. Can include '&', '<', '>', '"', "'", "\n"
Returns:
globalNamesAdded
()
static
This function is useful to make sure your code is not polluting the global namespace
interpolate
-
fields
Interpolates some fields into the string wherever "{{fieldName}}" appears or {{index}} appears.
Parameters:
Returns:
parseUrl
-
component
Analogous to PHP's parse_url function
Parameters:
-
component
StringOptional name of component to return
Returns:
queryField
-
name
-
[value]
Get or set querystring fields from a string, usually from location.search or location.hash
Parameters:
-
name
String | Array | ObjectThe name of the field. If it's an array, returns an object of {name: value} pairs. If it's an object, then they are added onto the querystring and the result is returned. If it's a string, it's the name of the field to get. And if it's an empty string, then we get the array of field names with no value, e.g. ?123&456&a=b returns [123,456]
-
[value]
String optionalOptional, provide a value to set in the querystring, or null to delete any fields that match name as a RegExp