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

    Function tryParseKeyName

    • Parse a key name, reporting failure instead of throwing it.

      The same reading as parseKeyName — that function is this one with its error thrown — for the callers where a name that does not parse yet is the normal state of the input rather than a fault.

      Parameters

      • text: string

        The key name.

      • Optionalopts: NoteNameOptions

        system reads the name in that notation system instead of detecting it.

      Returns ParseResult<KeyName>

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

      import { tryParseKeyName } from '@libraz/libcantus';
      const result = tryParseKeyName('gis moll');
      result.ok ? result.value.mode : result.error.message; // 'minor'