Namespace Jelo.Format
Formatting and conversion utilities.
Defined in: Jelo.Format.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Method Attributes | Method Name and Description |
---|---|
<static> |
Jelo.Format.cutHexHash(hex)
Mainly used by internal Jelo functions.
|
<static> |
Jelo.Format.fromJSON(json)
Converts a valid JSON string to a native Object.
|
<static> |
Jelo.Format.hexToB(hex)
Returns the "blue" value from a CSS-style hex string.
|
<static> |
Jelo.Format.hexToG(hex)
Returns the "green" value from a CSS-style hex string.
|
<static> |
Jelo.Format.hexToR(hex)
Returns the "red" value from a CSS-style hex string.
|
<static> |
Jelo.Format.hexToRGB(hex)
Splits a CSS-style hex value into a array of Red, Green, and Blue values.
|
<static> |
Jelo.Format.hyphenatedToCamelCase(str)
|
<static> |
Jelo.Format.rgbStringToArray(hex)
Converts a CSS RGB string to an array of RGB values.
|
<static> |
Jelo.Format.rgbToHex(hex)
Converts a CSS RGB string to a CSS hex string.
|
<static> |
Jelo.Format.toCamel(str)
Converts a string from CSS hyphenated to Javascript camelCase.
|
<static> |
Jelo.Format.urlDecode(str)
Alias for Jelo.Format.urldecode
|
<static> |
Jelo.Format.urldecode(str)
Port of http://php.net/urldecode by http://kevin.vanzonneveld.net
|
<static> |
Jelo.Format.urlEncode(str)
Alias for Jelo.Format.urlencode
|
<static> |
Jelo.Format.urlencode(str)
Port of http://php.net/urlencode by http://kevin.vanzonneveld.net
|
Method Detail
<static>
{String}
Jelo.Format.cutHexHash(hex)
Mainly used by internal Jelo functions. If a hash
mark (#) appears at the beginning of the string, it
will be stripped.
- Parameters:
- {String} hex
- A value such as "#0080FF"
- Returns:
- {String} A value such as "0080FF"
<static>
{Object}
Jelo.Format.fromJSON(json)
Converts a valid JSON string to a native Object.
- Parameters:
- {String} json
- A JSON-encoded string, e.g. '{ name : "John", age: "28" }'
- Returns:
- {Object} The object represented by valid input, or {} for invalid input.
<static>
{String}
Jelo.Format.hexToB(hex)
Returns the "blue" value from a CSS-style hex string.
- Parameters:
- {String} hex
- A value such as "#9966CC"
- Returns:
- {String} For the above example, "CC"
<static>
{String}
Jelo.Format.hexToG(hex)
Returns the "green" value from a CSS-style hex string.
- Parameters:
- {String} hex
- A value such as "#9966CC"
- Returns:
- {String} For the above example, "66"
<static>
{String}
Jelo.Format.hexToR(hex)
Returns the "red" value from a CSS-style hex string.
- Parameters:
- {String} hex
- A value such as "#9966CC"
- Returns:
- {String} For the above example, "99"
<static>
{Array}
Jelo.Format.hexToRGB(hex)
Splits a CSS-style hex value into a array of Red, Green, and Blue values.
- Parameters:
- {String} hex
- A value such as "#9966CC"
- Returns:
- {Array} For the above example, ["99", "66", "CC"]
<static>
Jelo.Format.hyphenatedToCamelCase(str)
- Parameters:
- str
- Deprecated:
- v1.02: Too long a name, replaced by {@link Jelo.Format.toCamel}
<static>
{Array}
Jelo.Format.rgbStringToArray(hex)
Converts a CSS RGB string to an array of RGB values. Mainly useful to
internal Jelo functions.
- Parameters:
- {String} hex
- A value such as "rgb(0, 128, 255)"
- Returns:
- {Array} For the above example, [0, 128, 255]
<static>
{Array}
Jelo.Format.rgbToHex(hex)
Converts a CSS RGB string to a CSS hex string. Mainly useful to
internal Jelo functions.
- Parameters:
- {String} hex
- A value such as "rgb(0, 128, 255)"
- Returns:
- {Array} For the above example, "#0080FF"
<static>
Jelo.Format.toCamel(str)
Converts a string from CSS hyphenated to Javascript camelCase.
// example:
var property = Jelo.Format.toCamel("margin-left");
alert(property); // alerts "marginLeft"
- Parameters:
- str
<static>
Jelo.Format.urlDecode(str)
Alias for Jelo.Format.urldecode
- Parameters:
- str
<static>
{String}
Jelo.Format.urldecode(str)
Port of http://php.net/urldecode by http://kevin.vanzonneveld.net
- Parameters:
- {String} str
- Returns:
- {String}
<static>
Jelo.Format.urlEncode(str)
Alias for Jelo.Format.urlencode
- Parameters:
- str
<static>
{String}
Jelo.Format.urlencode(str)
Port of http://php.net/urlencode by http://kevin.vanzonneveld.net
- Parameters:
- {String} str
- Returns:
- {String}