Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "lib.d"

Index

Variables

Const complement

complement: function

Complement of intervals bounded to boundaries. Convert space between two consecutive intervals into interval. Keeps extra object properties on boundaries. intervals array has to be sorted. Doesn't mutate input. Output keeps input's structure.

boundaries interval(s) result
{ start: 0, end: 10} [{ start: 3, end: 7 }] [{ start: 0, end: 3 }, { start: 7, end: 10 }]
{ start: 0, end: 10} [{ start: 2, end: 4 }, { start: 7, end: 8 }] [{ start: 0, end: 2 }, { start: 4, end: 7 }, { start: 8, end: 10 }]
param

arg1: interval defining boundaries for the complement computation.

param

arg2: array of intervals that complement the result.

returns

array of intervals.

Type declaration

    • <T>(boundaries: T, intervals: ReadonlyArray<IntervalSE>): T[]
    • Type parameters

      Parameters

      • boundaries: T
      • intervals: ReadonlyArray<IntervalSE>

      Returns T[]

Const convertARtoSE

convertARtoSE: function

Type declaration

    • (__namedParameters: [number, number]): IntervalSE
    • Parameters

      • __namedParameters: [number, number]

      Returns IntervalSE

Const convertFTtoSE

convertFTtoSE: function

Type declaration

    • <T>(r: T): Pick<T, Exclude<keyof T, "from" | "to">> & IntervalSE
    • Type parameters

      Parameters

      • r: T

      Returns Pick<T, Exclude<keyof T, "from" | "to">> & IntervalSE

Const convertSEtoAR

convertSEtoAR: function

Type declaration

Const convertSEtoFT

convertSEtoFT: function

Type declaration

    • <T>(r: T): Pick<T, Exclude<keyof T, "start" | "end">> & IntervalFT
    • Type parameters

      Parameters

      • r: T

      Returns Pick<T, Exclude<keyof T, "start" | "end">> & IntervalFT

Const intersect

intersect: function

Intersection of intervals. Does not simplify result. Keeps extra object properties on intervalB.

interalA and interalB can have different structure. Accept array of intervals. Doesn't mutate input. Output keeps intervalB structure. Intervals arrays have to be sorted.

interval(s) A interval(s) B result
{ from: 0, to: 4 } { start: 3, end: 7, foo: 'bar' } [{ start: 3, end: 4, foo: 'bar' }]
{ start: 0, end: 10 } [{ start: 2, end: 5}, { start: 5, end: 8}] [{ start: 2, end: 5 }, { start: 5, end: 8 }]
[{ start: 0, end: 4 }, { start: 8, end: 11 }] [{ start: 2, end: 9 }, { start: 10, end: 13 }] [{ start: 2, end: 4 }, { start: 8, end: 9 }, { start: 10, end: 11 }]
param

arg1: array of intervals

param

arg2: array of intervals

returns

intersection of arg1 and arg2

Type declaration

    • <T>(intervalsA: ReadonlyArray<IntervalSE>, intervalsB: ReadonlyArray<T>): T[]
    • Type parameters

      Parameters

      • intervalsA: ReadonlyArray<IntervalSE>
      • intervalsB: ReadonlyArray<T>

      Returns T[]

Const isAfter

isAfter: function

Test if intervalA is after or adjacent intervalB.

intervalA intervalB result
{ start: 5, end: 10} { start: 3, end: 4 } true
{ start: 5, end: 10} { start: 3, end: 6 } false
param

arg1: interval

param

arg2: interval

returns

true if after

Type declaration

Const isBefore

isBefore: function

Test if intervalA is before or adjacent intervalB.

intervalA intervalB result
{ start: 0, end: 2} { start: 3, end: 7 } true
{ start: 0, end: 5} { start: 3, end: 7 } false
param

arg1: interval

param

arg2: interval

returns

true if before

Type declaration

Const isDuring

isDuring: function

Test if intervalA occurs in intervalB. intervalsB act as boundaries. Can share starting and/or ending point.

intervalA intervalB result
{ start: 2, end: 6} { start: 0, end: 10 } true
{ start: 5, end: 10} { start: 0, end: 10 } true
{ start: 5, end: 10} { start: 0, end: 9 } false
param

arg1: interval

param

arg2: interval

returns

true if intervalA occurs in intervalB

Type declaration

Const isEnding

isEnding: function

Test if intervalA and intervalB share the same ending point.

intervalA intervalB result
{ start: 5, end: 10} { start: 0, end: 10 } true
{ start: 5, end: 10} { start: 5, end: 7 } false
param

arg1: interval

param

arg2: interval

returns

true if same ending point

Type declaration

Const isEqual

isEqual: function

Test if intervalA is equivalent to intervalB.

intervalA intervalB result
{ start: 5, end: 10} { start: 5, end: 10 } true
{ start: 5, end: 10} { start: 0, end: 10 } false
param

arg1: interval

param

arg2: interval

returns

true if equivalent

Type declaration

Const isMeeting

isMeeting: function

Test if intervalA is adjacent to (meets) intervalB.

intervalA intervalB result
{ start: 0, end: 10} { start: 3, end: 7 } false
{ start: 0, end: 5} { start: 5, end: 7 } true
param

arg1: interval

param

arg2: interval

returns

true if adjacent

Type declaration

Const isOverlapping

isOverlapping: function

Test if intervalA overlaps with intervalB.

Accept array of intervals. Intervals arrays have to be sorted.

intervalA intervalB result
{ start: 0, end: 10} { start: 3, end: 7 } true
{ start: 0, end: 5} { start: 5, end: 7 } false
{ start: 5, end: 10} [{ start: 0, end: 4 }, { start: 7, end: 8 }] true
param

arg1: interval or array of intervals

param

arg2: interval or array of intervals

returns

true if overlaps

Type declaration

Const isOverlappingSimple

isOverlappingSimple: function

Test if intervalA overlaps with intervalB.

intervalA intervalB result
{ start: 0, end: 10} { start: 3, end: 7 } true
{ start: 0, end: 5} { start: 5, end: 7 } false
param

arg1: interval

param

arg2: interval

returns

true if overlaps

Type declaration

Const isStarting

isStarting: function

Test if intervalA and intervalB share the same starting point.

intervalA intervalB result
{ start: 5, end: 10} { start: 5, end: 4 } true
{ start: 5, end: 10} { start: 0, end: 10 } false
param

arg1: interval

param

arg2: interval

returns

true if same starting point

Type declaration

Const merge

merge: function

Merge extra properties of all intervals inside intervals, when overlapping, with provided function mergeFn. Can also be used to generate an array of intervals without overlaps

Doesn't mutate input. Output keeps input's structure. Interval array has to be sorted.

parameter value
mergeFn (a, b) => {...a, data: a.data + b.data }
intervals [{ start: 0, end: 10, data: 5 }, { start: 4, end: 7, data: 100 }]
result [{ start: 0, end: 4, data: 5 }, { start: 4, end: 7, data: 105 }, { start: 7, end: 10, data: 5 }]
param

arg1: function to merge extra properties of overlapping intervals

param

arg2: intervals with extra properties.

Type declaration

    • <T>(mergeFn: function, intervals: ReadonlyArray<T>): T[]
    • Type parameters

      Parameters

      • mergeFn: function
          • (ints: any[]): any
          • Parameters

            • ints: any[]

            Returns any

      • intervals: ReadonlyArray<T>

      Returns T[]

Const simplify

simplify: function

Simplification of intervals. Unify touching or overlapping intervals.

Intervals array has to be sorted.

Doesn't mutate input. Output keeps input's structure.

intervals A result
[{ start: 3, end: 9 }, { start: 9, end: 13 }, { start: 11, end: 14 }] [{ start: 3, end: 14 }]
param

Type declaration

    • <T>(intervals: ReadonlyArray<T>): T[]
    • Type parameters

      Parameters

      • intervals: ReadonlyArray<T>

      Returns T[]

Const split

split: function

Split intervals with splitIndexes. Keeps extra object properties on intervals. Doesn't mutate input. Output keeps input's structure.

splitIndexes interval(s) result
[2, 4] { start: 0, end: 6, foo: 'bar' } [{ start: 0, end: 2, foo: 'bar' }, { start: 2, end: 4, foo: 'bar' } { start: 4, end: 6, foo: 'bar' }]
[5] [{ start: 0, end: 7 }, { start: 3, end: 8 }] [{ start: 0, end: 5 }, { start: 5, end: 7 }, { start: 3, end: 5 }, { start: 5, end: 8 }]
param

arg1: defines indexes where intervals are splitted.

param

arg2: intervals to be splitted.

returns

array of intervals.

Type declaration

    • <T>(splits: ReadonlyArray<number>, intervals: ReadonlyArray<T>): T[]
    • Type parameters

      Parameters

      • splits: ReadonlyArray<number>
      • intervals: ReadonlyArray<T>

      Returns T[]

Const substract

substract: function

Subtact base with mask. Keeps extra object properties on base.

Accept array of intervals. Doesn't mutate input. Output keeps input's structure. Intervals arrays have to be sorted.

interval(s) base interval(s) mask result
[{ start: 0, end: 4 }] [{ start: 3, end: 7 }] [{ start: 0, end: 3 }]
[{ start: 0, end: 4 }, { start: 8, end: 11 }] [{ start: 2, end: 9 }, { start: 10, end: 13 }] [{ start: 0, end: 2 }, { start: 9, end: 10 }]
param

arg1: array of intervals

param

arg2: array of intervals

returns

intersection of arg1 and arg2

Type declaration

    • <T>(base: ReadonlyArray<T>, mask: ReadonlyArray<IntervalSE>): T[]
    • Type parameters

      Parameters

      • base: ReadonlyArray<T>
      • mask: ReadonlyArray<IntervalSE>

      Returns T[]

Const unify

unify: function

Union of intervals.

Accept array of intervals. Doesn't mutate input. Output keeps input's structure. Intervals arrays have to be sorted.

interval(s) A interval(s) B result
[{ start: 0, end: 4}] [{ start: 3, end: 7 }, { start: 9, end: 11 }] [{ start: 0, end: 7 }, { start: 9, end: 11 }]
param

arg1: array of intervals

param

arg2: array of intervals

returns

union of arg1 and arg2

Type declaration

    • <T>(intervalsA: ReadonlyArray<T>, intervalsB: ReadonlyArray<T>): IntervalSE[]
    • Type parameters

      Parameters

      • intervalsA: ReadonlyArray<T>
      • intervalsB: ReadonlyArray<T>

      Returns IntervalSE[]

Generated using TypeDoc