time-ranges

time-ranges.js

Methods

inner createTimeRangesObj(rangesopt)

Create a time range object givent ranges of time.

Parameters:
Name Type Attributes Description
ranges Array <optional>

An array of time ranges.

inner getRange(fnName, valueIndex, ranges, rangeIndexopt) → {number}

Check if any of the time ranges are over the maximum index.

Parameters:
Name Type Attributes Default Description
fnName string

The function name to use for logging

valueIndex string

The proprety that should be used to get the time. should be 'start' or 'end'

ranges Array

An array of time ranges

rangeIndex Array <optional>
0

The index to start the search at

Throws:

if rangeIndex is more than the length of ranges

Type
Error
Returns:
number -

The time that offset at the specified index.

inner rangeCheck(fnName, index, maxIndex)

Check if any of the time ranges are over the maximum index.

Parameters:
Name Type Description
fnName string

The function name to use for logging

index number

The index to check

maxIndex number

The maximum possible index

Throws:

if the timeRanges provided are over the maxIndex

Type
Error

inner time-ranges:indexFunction(indexopt) → {number}

Returns the time for the specified index at the start or end of a TimeRange object.

Parameters:
Name Type Attributes Default Description
index number <optional>
0

The range number to return the time for.

Returns:
number -

The time that offset at the specified index.

Type Definitions

TimeRange

An object that contains ranges of time for various reasons.

Properties:
Name Type Description
length number

The number of time ranges represented by this Object

start time-ranges:indexFunction

Returns the time offset at which a specified time range begins.

end time-ranges:indexFunction

Returns the time offset at which a specified time range begins.

See: