Namespace: Utils

Utils

Methods

<static> capitalizeFirstLetter(string) → {string}

Capitalizes the first character in a string.
Parameters:
Name Type Description
string string The string to capitalize.
Source:
Returns:
The string with the first character capitalized.
Type
string

<static> constrain(val, low, high) → {number}

Constrain a value within a range.
Parameters:
Name Type Description
val number The value to constrain.
low number The lower bound of the range.
high number The upper bound of the range.
Source:
Returns:
A number.
Type
number

<static> degreesToRadians(degrees) → {number}

Converts degrees to radians.
Parameters:
Name Type Description
degrees number The degrees value to be converted.
Source:
Returns:
A number in radians.
Type
number

<static> extend(subClass, superClass)

Extends the properties and methods of a superClass onto a subClass.
Parameters:
Name Type Description
subClass Object The subClass.
superClass Object The superClass.
Source:

<static> getRandomNumber(low, high, flt) → {number}

Generates a psuedo-random number within an inclusive range.
Parameters:
Name Type Argument Description
low number The low end of the range.
high number The high end of the range.
flt boolean <optional>
Set to true to return a float or when passing floats as a range.
Source:
Returns:
A number.
Type
number

<static> isInside(obj, container) → {boolean}

Determines if one object is inside another.
Parameters:
Name Type Description
obj Object The object.
container Object The containing object.
Source:
Returns:
Returns true if the object is inside the container.
Type
boolean

<static> map(value, min1, max1, min2, max2) → {number}

Re-maps a number from one range to another.
Parameters:
Name Type Description
value number The value to be converted.
min1 number Lower bound of the value's current range.
max1 number Upper bound of the value's current range.
min2 number Lower bound of the value's target range.
max2 number Upper bound of the value's target range.
Source:
Returns:
A number.
Type
number

<static> radiansToDegrees(radians) → {number}

Converts radians to degrees.
Parameters:
Name Type Description
radians number The radians value to be converted.
Source:
Returns:
A number in degrees.
Type
number