Methods
-
<static> changeType( value, type ) → {*}
-
Description
Changes the type of a value to int, float or bool
Parameters
Name Type Description value* typestring '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 objfunction fieldsArray.<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 doThrowboolean <optional> true typestring messagestring args* <repeatable> Details
-
<static> escapeElementId( str ) → {string}
-
Description
Escapes a string for use in HTML element id
Parameters
Name Type Description strstring Returns
Details
-
<static> escapeRegExp( str ) → {string}
-
Description
Escapes a string for use in regex
Parameters
Name Type Description strstring Returns
Details
-
<static> escapeString( value ) → {string}
-
Description
Escapes a string like PHP's mysql_real_escape_string does
Parameters
Name Type Description valuestring Returns
Details
-
<static> fmt( str, ...args ) → {string}
-
Description
Replaces {0}, {1}, ... in a string
Parameters
Name Type Attributes Description strstring 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 itemsArray.<object> keystring Returns
Details
-
<static> iterateOptions( options, tpl )
-
Description
Iterates over radio/checkbox/selection options, it accept four formats
Parameters
Name Type Description optionsobject | array tplUtils#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 keystring valuestring optgroupstring <optional> Details