Methods
-
<static> changeType( value, type [, boolAsInt ] ) → {*}
-
Description
Changes the type of a value to int, float or bool
Parameters
Name Type Attributes Default Description value
* type
string 'integer', 'double', 'boolean' or anything else (passthrough)
boolAsInt
boolean <optional> false return 0 or 1 for booleans
Returns
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 three 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'}]
Details
Type Definitions
-
OptionsIteratee( key, value )
-
Parameters
Name Type Description key
string value
string Details