utils

Internal utilities.

Source:

Methods

addConstantTo()

# | source: util/utils.js, line 147

Adds a constant to the given object, the constant is not enumerable and not configurable.

assertBoolean(…elements) → {boolean}

# | source: util/utils.js, line 103

Asserts that all elements are boolean primitives, otherwise a Rac.Exception.failedAssert is thrown.

Parameters:
Name Type Attributes Description
elements boolean <repeatable>

assertExists(…parameters) → {boolean}

# | source: util/utils.js, line 13

Asserts that all passed parameters are objects or primitives. If any parameter is null or undefined a Rac.Exception.failedAssert is thrown.

Parameters:
Name Type Attributes Description
parameters Object | primitive <repeatable>

assertNumber(…elements) → {boolean}

# | source: util/utils.js, line 63

Asserts that all elements are number primitives and not NaN, otherwise a Rac.Exception.failedAssert is thrown.

Parameters:
Name Type Attributes Description
elements number <repeatable>

assertString(…elements) → {boolean}

# | source: util/utils.js, line 83

Asserts that all elements are string primitives, otherwise a Rac.Exception.failedAssert is thrown.

Parameters:
Name Type Attributes Description
elements string <repeatable>

assertType(type, …elements) → {boolean}

# | source: util/utils.js, line 38

Asserts that all elements are objects or the given type, otherwise a Rac.Exception.failedAssert is thrown.

When any member of elements is null or undefined, the exception is also thrown.

Parameters:
Name Type Attributes Description
type function
elements Object <repeatable>

cutDigits(number, digitsopt, nullable) → {string}

# | source: util/utils.js, line 164

Returns a string of number format using fixed-point notation or the complete number string.

Parameters:
Name Type Attributes Description
number number

The number to format

digits number <optional>
<nullable>

The amount of digits to print, or null to print all digits.

typeName(obj) → {string}

# | source: util/utils.js, line 123

Returns the constructor name of obj, or its type name. Convenience function for debugging and errors.

Parameters:
Name Type Description
obj object

An Object to get its type name