Unicode MessageFormat for JavaScript
    Preparing search index...

    Function validate

    • Ensure that the msg data model is valid, calling onError on errors. If onError is not defined, a MessageDataModelError will be thrown on error.

      Detects the following errors:

      • 'key-mismatch': Variant Key Mismatch
        The number of keys on a variant does not equal the number of selectors.

      • 'missing-fallback': Missing Fallback Variant
        The message does not include a variant with only catch-all keys.

      • 'missing-selector-annotation': Missing Selector Annotation
        A selector does not contains a variable that directly or indirectly reference a declaration with a function.

      • 'duplicate-declaration': Duplicate Declaration
        A variable appears in two declarations.

      • 'duplicate-variant': Duplicate Variant
        The same list of keys is used for more than one variant.

      Parameters

      • msg: Model.Message
      • onError: (
            type:
                | "duplicate-declaration"
                | "duplicate-variant"
                | "key-mismatch"
                | "missing-fallback"
                | "missing-selector-annotation",
            node: Node,
        ) => void = ...

      Returns { functions: Set<string>; variables: Set<string> }

      The sets of runtime functions and variables used by the message.