utils

Internal utilities.

Methods

addConstantTo()

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

assertBoolean(…elements) → {Boolean}

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}

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}

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}

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}

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}

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}

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