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

    Function tryParseChordSymbol

    • Parse a lead-sheet chord symbol, reporting failure instead of throwing it.

      The same reading as parseChordSymbol — that function is this one with its error thrown — for the callers where a symbol that does not parse yet is the normal state of the input rather than a fault: a chord field says what is wrong with what has been typed so far, and does not need a try around every keystroke to do it.

      Parameters

      • text: string

        The chord symbol text.

      • Optionalopts: NoteNameOptions

        system reads the root and bass in that notation system instead of English.

      Returns ParseResult<ChordData>

      The chord, or the error explaining why the text is not one.

      import { tryParseChordSymbol } from '@libraz/libcantus';
      const result = tryParseChordSymbol('Cmaj7(#11)');
      result.ok ? result.value.intervals : result.error.message;