Function isCategory

  • Use instead of instanceof as a more flexible type guard.

    Type Parameters

    • T

    Parameters

    • obj: any

      check if this object's CATEGORY matches the provided category.

    • category: string

      a string representing a category of VexFlow objects.

    • checkAncestors: boolean = true

      defaults to true, so we walk up the prototype chain to look for a matching CATEGORY. If false, we do not check the superclass or other ancestors.

    Returns obj is T

    true if obj has a static CATEGORY property that matches category.