Methods
-
<static> changeType( value, type ) → {*}
-
Description
Changes the type of a value to int, float or bool
Parameters
Name Type Description value
* type
string 'integer', 'double', 'boolean' or anything else (passthrough)
Returns
Details
-
<static> defineModelProperties( obj, fields )
-
Description
Defines properties on an Node prototype with getter and setter.
Update events are emitted in the setter through root Model (if any).
The object must have a__
object, non enumerable property to store values.Parameters
Name Type Description obj
function fields
Array.<string> Details
-
<static> error( [ doThrow ], type, message, ...args )
-
Description
Throws an Error object with custom name or logs an error
Parameters
Name Type Attributes Default Description doThrow
boolean <optional> true type
string message
string args
* <repeatable> Details
-
<static> escapeElementId( str ) → {string}
-
Description
Escapes a string for use in HTML element id
Parameters
Name Type Description str
string Returns
Details
-
<static> escapeRegExp( str ) → {string}
-
Description
Escapes a string for use in regex
Parameters
Name Type Description str
string Returns
Details
-
<static> escapeString( value ) → {string}
-
Description
Escapes a string like PHP's mysql_real_escape_string does
Parameters
Name Type Description value
string Returns
Details
-
<static> fmt( str, ...args ) → {string}
-
Description
Replaces {0}, {1}, ... in a string
Parameters
Name Type Attributes Description str
string args
* <repeatable> Returns
Details
-
<static> groupSort( items, key ) → {Array.<object>}
-
Description
Sorts objects by grouping them by
key
, preserving initial order when possibleParameters
Name Type Description items
Array.<object> key
string Returns
Details
-
<static> iterateOptions( options, tpl )
-
Description
Iterates over radio/checkbox/selection options, it accept four formats
Parameters
Name Type Description options
object | array tpl
Utils#OptionsIteratee Examples
// array of values options = ['one', 'two', 'three']
// simple key-value map options = {1: 'one', 2: 'two', 3: 'three'}
// array of 1-element maps options = [{1: 'one'}, {2: 'two'}, {3: 'three'}]
// array of elements options = [{value: 1, label: 'one', optgroup: 'group'}, {value: 2, label: 'two'}]
Details
Type Definitions
-
OptionsIteratee( key, value [, optgroup ] )
-
Parameters
Name Type Attributes Description key
string value
string optgroup
string <optional> Details