# Utility

## Methods

#### # (static) doEasing(duration, onStep, ?callback) → {void}

Provides easing functionality using easeInOutCubic.
Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`duration` | number |  | The duration over which to apply the easing
`onStep` | onStepCallback |  | The function to run at each easing step
`callback` | function | <optional> | The function to run after the easing is complete

Source:
  - index.js, line 854
Tutorials:
  - doEasing

Returns:
void

Type
  void

#### # (static) generateHash(string) → {number}

Generates a unique number hash from a string.
Parameters:

Name | Type | Description
--- | --- | ---
`string` | string | The string to hash

Source:
  - index.js, line 797
Tutorials:
  - generateHash

Returns:
The converted string

Type
  number

#### # (static) isEmptyObject(object) → {boolean}

Checks if an object is empty.
Parameters:

Name | Type | Description
--- | --- | ---
`object` | object | The object to check

Source:
  - index.js, line 811
Tutorials:
  - isEmptyObject

Returns:
If the object is empty

Type
  boolean

#### # (static) isSameObject(object1, object2) → {boolean}

Checks if two objects are the same.
Parameters:

Name | Type | Description
--- | --- | ---
`object1` | object | The object to compare
`object2` | object | The object to compare to

Source:
  - index.js, line 824
Tutorials:
  - isSameObject

Returns:
If the objects are the same

Type
  boolean

#### # (static) noop() → {void}

Provides an empty function.

Source:
  - index.js, line 776
Tutorials:
  - noop

Returns:
void

Type
  void

#### # (static) preventEvent(event) → {void}

Prevents the events default beheavior, propagation and immediate propagation
Parameters:

Name | Type | Description
--- | --- | ---
`event` | Event | The event to prevent

Source:
  - index.js, line 838
Tutorials:
  - preventEvent

Returns:
void

Type
  void

#### # (static) uniqid() → {string}

Generates a semi-random string of length 9.

Source:
  - index.js, line 785
Tutorials:
  - uniqid

Returns:
The generated string

Type
  string

#### # (inner) contains($elements) → {boolean}

Whether the collections elements contain at least one of elements.
Parameters:

Name | Type | Description
--- | --- | ---
`$elements` | jLight | string | HTMLElement | HTMLCollection | NodeList | The elements to supply to the function

Source:
  - index.js, line 3810
Tutorials:
  - contains

Returns:
If the conditon is met

Type
  boolean

#### # (inner) delay(?delay) → {Promise}

Delays code execution.
Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`delay` | number | <optional> | The duration to delay the code execution for

Source:
  - index.js, line 3923
Tutorials:
  - delay

Returns:
The corresponding promise

Type
  Promise

#### # (inner) inView(?offsetOrCallback, ?callbackOrOptions) → {jLight|boolean}

Checks if the collections first element is in view or runs a function if that is the case.
Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`offsetOrCallback` | function | Object | <optional> | The offset used for determining if the element is in view or the function to run each time that is the case
`callbackOrOptions` | function | Object | <optional> | The function to run each time the element is in view or a custom options object to define the functions behavior (defaults: { scrollTimer: 100, isInView: noop, onEnter: noop, onExit: noop })

Source:
  - index.js, line 3843
Tutorials:
  - inView

Returns:
jLight collection or whether the collections first element is in view

Type
  jLight | boolean

#### # (inner) is(propertyOrElements) → {boolean}

Whether a property of an element of the collection is true or if an element of the collection is part of another set.
Parameters:

Name | Type | Description
--- | --- | ---
`propertyOrElements` | jLight | string | HTMLElement | HTMLCollection | NodeList | The property or set to compare the collections elements to

Source:
  - index.js, line 3777
Tutorials:
  - is

Returns:
If the property is set on one of the collections elements or at least on of the elements is contained in the supplied elements

Type
  boolean

#### # (inner) serialize() → {string}

Serializes the collections elements values to a URL encoded string.

Source:
  - index.js, line 3956
Tutorials:
  - serialize

Returns:
The resulting string

Type
  string

#### # (inner) serializeJson() → {Object.<string, string>}

Serializes the collections elements values to a JSON object.

Source:
  - index.js, line 3984
Tutorials:
  - serializeJson

Returns:
The resulting JSON object

Type
  Object.<string, string>

#### # (inner) when(condition, callback, ?…args) → {jLight}

Calls the supplied function with the supplied arguments if the given condition is met.
Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`condition` | boolean | function |  | The condition to check for. If a function is supplied its return value will be used for checking
`callback` | string | function |  | The function to run when the condition is met. If a string is provided it should be a valid jLight function name
`args` | * | <optional> <repeatable> | The arguments to supply to the given jLight function

Source:
  - index.js, line 3937
Tutorials:
  - when

Returns:
jLight collection

Type
  jLight

## Methods

#### # (static) doEasing(duration, onStep, ?callback) → {void}

Provides easing functionality using easeInOutCubic.
Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`duration` | number |  | The duration over which to apply the easing
`onStep` | onStepCallback |  | The function to run at each easing step
`callback` | function | <optional> | The function to run after the easing is complete

Source:
  - index.js, line 854
Tutorials:
  - doEasing

Returns:
void

Type
  void

#### # (static) generateHash(string) → {number}

Generates a unique number hash from a string.
Parameters:

Name | Type | Description
--- | --- | ---
`string` | string | The string to hash

Source:
  - index.js, line 797
Tutorials:
  - generateHash

Returns:
The converted string

Type
  number

#### # (static) isEmptyObject(object) → {boolean}

Checks if an object is empty.
Parameters:

Name | Type | Description
--- | --- | ---
`object` | object | The object to check

Source:
  - index.js, line 811
Tutorials:
  - isEmptyObject

Returns:
If the object is empty

Type
  boolean

#### # (static) isSameObject(object1, object2) → {boolean}

Checks if two objects are the same.
Parameters:

Name | Type | Description
--- | --- | ---
`object1` | object | The object to compare
`object2` | object | The object to compare to

Source:
  - index.js, line 824
Tutorials:
  - isSameObject

Returns:
If the objects are the same

Type
  boolean

#### # (static) noop() → {void}

Provides an empty function.

Source:
  - index.js, line 776
Tutorials:
  - noop

Returns:
void

Type
  void

#### # (static) preventEvent(event) → {void}

Prevents the events default beheavior, propagation and immediate propagation
Parameters:

Name | Type | Description
--- | --- | ---
`event` | Event | The event to prevent

Source:
  - index.js, line 838
Tutorials:
  - preventEvent

Returns:
void

Type
  void

#### # (static) uniqid() → {string}

Generates a semi-random string of length 9.

Source:
  - index.js, line 785
Tutorials:
  - uniqid

Returns:
The generated string

Type
  string

#### # (inner) contains($elements) → {boolean}

Whether the collections elements contain at least one of elements.
Parameters:

Name | Type | Description
--- | --- | ---
`$elements` | jLight | string | HTMLElement | HTMLCollection | NodeList | The elements to supply to the function

Source:
  - index.js, line 3810
Tutorials:
  - contains

Returns:
If the conditon is met

Type
  boolean

#### # (inner) delay(?delay) → {Promise}

Delays code execution.
Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`delay` | number | <optional> | The duration to delay the code execution for

Source:
  - index.js, line 3923
Tutorials:
  - delay

Returns:
The corresponding promise

Type
  Promise

#### # (inner) inView(?offsetOrCallback, ?callbackOrOptions) → {jLight|boolean}

Checks if the collections first element is in view or runs a function if that is the case.
Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`offsetOrCallback` | function | Object | <optional> | The offset used for determining if the element is in view or the function to run each time that is the case
`callbackOrOptions` | function | Object | <optional> | The function to run each time the element is in view or a custom options object to define the functions behavior (defaults: { scrollTimer: 100, isInView: noop, onEnter: noop, onExit: noop })

Source:
  - index.js, line 3843
Tutorials:
  - inView

Returns:
jLight collection or whether the collections first element is in view

Type
  jLight | boolean

#### # (inner) is(propertyOrElements) → {boolean}

Whether a property of an element of the collection is true or if an element of the collection is part of another set.
Parameters:

Name | Type | Description
--- | --- | ---
`propertyOrElements` | jLight | string | HTMLElement | HTMLCollection | NodeList | The property or set to compare the collections elements to

Source:
  - index.js, line 3777
Tutorials:
  - is

Returns:
If the property is set on one of the collections elements or at least on of the elements is contained in the supplied elements

Type
  boolean

#### # (inner) serialize() → {string}

Serializes the collections elements values to a URL encoded string.

Source:
  - index.js, line 3956
Tutorials:
  - serialize

Returns:
The resulting string

Type
  string

#### # (inner) serializeJson() → {Object.<string, string>}

Serializes the collections elements values to a JSON object.

Source:
  - index.js, line 3984
Tutorials:
  - serializeJson

Returns:
The resulting JSON object

Type
  Object.<string, string>

#### # (inner) when(condition, callback, ?…args) → {jLight}

Calls the supplied function with the supplied arguments if the given condition is met.
Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`condition` | boolean | function |  | The condition to check for. If a function is supplied its return value will be used for checking
`callback` | string | function |  | The function to run when the condition is met. If a string is provided it should be a valid jLight function name
`args` | * | <optional> <repeatable> | The arguments to supply to the given jLight function

Source:
  - index.js, line 3937
Tutorials:
  - when

Returns:
jLight collection

Type
  jLight