API Documentation for utils
isArray ⇒ Boolean
This is a polyfill for the Array.isArray function. Determines whether the passed obect is an Array.
Kind: global variable
Returns: Boolean
- returns true if the passed object is an Array.
Param | Type |
---|---|
vArg | object |
isset(object) ⇒ boolean
Determines if the provided value has been defined.
Kind: global function
Param | Type |
---|---|
object | mixed |
hash_key(value) ⇒ string
| null
Converts a scalar to its best string representation for hash keys and HTML attribute values.
Transformations: 'str' -> 'str' null -> '' undefined -> '' true -> '1' false -> '0' 0 -> '0' 1 -> '1'
Kind: global function
Param | Type |
---|---|
value | string |
escape_html(str) ⇒ string
Escapes a string for use within HTML.
Kind: global function
Param | Type |
---|---|
str | string |
escape_replace(str) ⇒ string
Escapes "$" characters in replacement strings.
Kind: global function
Param | Type |
---|---|
str | string |
once(fn) ⇒ function
Wraps fn
so that it can only be invoked once.
Kind: global function
Param | Type |
---|---|
fn | function |
debounce(fn, delay) ⇒ function
Wraps fn
so that it can only be called once
every delay
milliseconds (invoked on the falling edge).
Kind: global function
Param | Type |
---|---|
fn | function |
delay | number |
debounce_events(self, types, fn)
Debounce all fired events types listed in types
while executing the provided fn
.
Kind: global function
Param | Type |
---|---|
self | object |
types | array |
fn | function |
watchChildEvent($parent, event, selector, fn)
A workaround for http://bugs.jquery.com/ticket/6696
Kind: global function
Param | Type | Description |
---|---|---|
$parent | object | Parent element to listen on. |
event | string | Event name. |
selector | string | Descendant selector to filter by. |
fn | function | Event handler. |
getInputSelection(input) ⇒ object
Determines the current selection within a text input control. Returns an object containing:
- start
- length
Kind: global function
Param | Type |
---|---|
input | object |
transferStyles($from, $to, properties)
Copies CSS properties from one element to another.
Kind: global function
Param | Type |
---|---|
$from | object |
$to | object |
properties | array |
measureString(str, $parent) ⇒ number
Measures the width of a string within a parent element (in pixels).
Kind: global function
Param | Type |
---|---|
str | string |
$parent | object |
autoGrow($input)
Sets up an input to grow horizontally as the user types. If the value is changed manually, you can trigger the "update" handler to resize:
$input.trigger('update');
Kind: global function
Param | Type |
---|---|
$input | object |
isJSON(data) ⇒ Boolean
Determines whether or not the data
argument is a valid JSON string.
Kind: global function
Returns: Boolean
- true if is an JSON object
Param | Type | Description |
---|---|---|
data | String | Data to test |
uaDetect(platform, re) ⇒ Boolean
If the browser supports the User-Agent Client Hint, then return the platform name, otherwise return the result of a regular expression test on the user agent string
Kind: global function
Returns: Boolean
- A boolean value.
Param | Description |
---|---|
platform | The platform you want to detect. |
re | A regular expression that matches the user agent string. |