Class: core/Utils

core/Utils

new core/Utils()

Utilities - helper tool set static class.
Source:

Methods

(static) argToArr(value) → {Array}

Converts given argument list to array.
Parameters:
Name Type Description
value Arguments Value to convert.
Source:
Returns:
Result.
Type
Array

(static) clone(…objects) → {Object}

Creates new object and extends with all objects given as arguments.
Parameters:
Name Type Attributes Description
objects Object <repeatable>
Object list.
Source:
Returns:
Extended new object.
Type
Object

(static) cloneArray(arr) → {Array}

Clones an array and returns new reference.
Parameters:
Name Type Description
arr Array Array to clone.
Source:
Returns:
New cloned array.
Type
Array

(static) each(arr, callback, reference)

Calls callback for each item of given array.
Parameters:
Name Type Description
arr Array Item list.
callback function Callback function.
reference Object Reference to pass into callback.
Source:

(static) extend(…objects) → {Object}

Extends object given at first parameter with objects at other parameters.
Parameters:
Name Type Attributes Description
objects Object <repeatable>
Object list.
Source:
Returns:
Extended first object at arguments.
Type
Object

(static) inArray(arr, item) → {boolean}

Returns if array has search item.
Parameters:
Name Type Description
arr Array Item list.
item * Search item.
Source:
Returns:
If array has search item.
Type
boolean

(static) isArray(value) → {boolean}

Returns if given value is an Array.
Parameters:
Name Type Description
value * Value to check.
Source:
Returns:
Result.
Type
boolean

(static) isBoolean(value) → {boolean}

Returns if given value is boolean.
Parameters:
Name Type Description
value * Value to check.
Source:
Returns:
Result.
Type
boolean

(static) isEmpty(value) → {boolean}

Returns if given value is empty. Empty values are; empty string, zero number, false, undefined, zero length arrays/objects.
Parameters:
Name Type Description
value * Value to check.
Source:
Returns:
Result.
Type
boolean

(static) isFunction(value) → {boolean}

Returns if given value is a function.
Parameters:
Name Type Description
value * Value to check.
Source:
Returns:
Result.
Type
boolean

(static) isNull(value) → {boolean}

Returns if given value is null.
Parameters:
Name Type Description
value * Value to check.
Source:
Returns:
Result.
Type
boolean

(static) isNumber(value) → {boolean}

Returns if given value is number.
Parameters:
Name Type Description
value * Value to check.
Source:
Returns:
Result.
Type
boolean

(static) isObject(value) → {boolean}

Returns if given value is an Object.
Parameters:
Name Type Description
value * Value to check.
Source:
Returns:
Result.
Type
boolean

(static) isSet(value) → {boolean}

Returns if given value is set - not null and undefined.
Parameters:
Name Type Description
value * Value to check.
Source:
Returns:
Result.
Type
boolean

(static) isString(value) → {boolean}

Returns if given value is string.
Parameters:
Name Type Description
value * Value to check.
Source:
Returns:
Result.
Type
boolean

(static) isUndefined(value) → {boolean}

Returns if given value is undefined.
Parameters:
Name Type Description
value * Value to check.
Source:
Returns:
Result.
Type
boolean

(static) isUnset(value) → {boolean}

Returns if given value is unset - null or undefined.
Parameters:
Name Type Description
value * Value to check.
Source:
Returns:
Result.
Type
boolean

(static) map(arr, callback, reference) → {Array}

Creates new array using given array with calls callback for each item.
Parameters:
Name Type Description
arr Array Item list.
callback function Callback function.
reference Object Reference to pass into callback.
Source:
Returns:
Result array.
Type
Array

(static) pad(n, width, z) → {string}

Adds pads to given string.
Parameters:
Name Type Description
n string String to pad.
width number Pad width.
z string Padding character.
Source:
Returns:
Padded string.
Type
string

(static) toFloat(value) → {number}

Converts given any value to number.
Parameters:
Name Type Description
value * Value to convert.
Source:
Returns:
Result.
Type
number

(static) toString(value) → {string}

Converts given any value to string.
Parameters:
Name Type Description
value * Value to convert.
Source:
Returns:
Result.
Type
string