Module: util

Methods

(static) arrayOf(array, predicate) → {Boolean}

Check if all items in an array match a predicate
Parameters:
Name Type Description
array Array
predicate predicateFn
Source:
Returns:
Type
Boolean

(static) autobind(methodNames, instance)

Bind all methods of an object to itself
Parameters:
Name Type Description
methodNames Array.<function()>
instance Object
Source:

(static) captialize(string) → {string}

Captialize a string
Parameters:
Name Type Description
string string
Source:
Returns:
Type
string

(static) clamp(value, min, max) → {number}

Clamp a value between a min and max value
Parameters:
Name Type Description
value number
min number
max number
Source:
Returns:
Type
number

(static) distanceTo(pointA, pointB) → {number}

Calculate the distance between pointA and pointB
Parameters:
Name Type Description
pointA Point
pointB Point
Source:
Returns:
Distance
Type
number

(static) extend(object, …sources) → {Object}

Extend an Object
Parameters:
Name Type Attributes Description
object Object Destination object
sources Object <repeatable>
Source objects
Source:
Returns:
Destination object, extended with members from sources
Type
Object

(static) includes(array, value) → {boolean}

Check if a value is included in an array
Parameters:
Name Type Description
array Array
value number
Source:
Returns:
Type
boolean

(static) isDefined(value) → {Boolean}

Check if a value is defined
Parameters:
Name Type Description
value *
Source:
Returns:
Type
Boolean

(static) isEmpty(obj) → {Boolean}

Check if an object is empty
Parameters:
Name Type Description
obj Object | Array
Source:
Returns:
Type
Boolean

(static) isNumber(value) → {Boolean}

Check if a value is a number
Parameters:
Name Type Description
value *
Source:
Returns:
Type
Boolean

(static) isObject(value) → {Boolean}

Check if a value is an object
Parameters:
Name Type Description
value *
Source:
Returns:
Type
Boolean

(static) length(numA, numB) → {number}

Calculate the absolute difference between two numbers
Parameters:
Name Type Description
numA number
numB number
Source:
Returns:
Type
number

(static) objectOf(object, predicate, keys) → {Boolean}

Check if all items in an object match a predicate
Parameters:
Name Type Description
object Object
predicate predicateFn
keys Array.<string>
Source:
Returns:
Type
Boolean

(static) omit(obj, omitKeys) → {Object}

Return a new object without the specified keys
Parameters:
Name Type Description
obj Object
omitKeys Array.<string>
Source:
Returns:
Type
Object

Type Definitions

predicateFn(value) → {boolean}

Parameters:
Name Type Description
value *
Source:
Returns:
Type
boolean