@libraz/libcantus - v1.1.0
    Preparing search index...

    Function assertChordTimeline

    • Reject a value that is not a chord timeline.

      A timeline is the one argument a host is most likely to hold from somewhere else — an in-memory project value, a previous run restored to a timeline, or another library's output — and it is read field by field deep inside an analysis. Checking it once at the entrance names the argument that is wrong instead of reporting the library's own TypeError from wherever the first segments lookup happened to be.

      The segments are checked too: every reader of a timeline compares beats, and a segment whose bounds are missing compares as neither before nor after, so it disappears from the analysis rather than being reported.

      Parameters

      • timeline: ChordTimeline

        The timeline as the caller passed it.

      • name: string = 'timeline'

        What the argument is called in an error message.

      Returns ChordTimeline

      The same timeline.

      If the value is not a timeline of chord segments.

      import { assertChordTimeline, chordTimelineFromChords } from '@libraz/libcantus';
      assertChordTimeline(chordTimelineFromChords([], 4)); // the timeline, unchanged