Function tokenize

  • Given a string with a scale name and (optionally) a tonic, split that components.

    It retuns an array with the form [ name, tonic ] where tonic can be a note name or null and name can be any arbitrary string (this function doesn"t check if that scale name exists)

    Parameters

    • name: string

      the scale name

    Returns ScaleNameTokens

    an array [tonic, name]

    Function

    Example

    tokenize("C mixolydean") // => ["C", "mixolydean"]
    tokenize("anything is valid") // => ["", "anything is valid"]
    tokenize() // => ["", ""]