• Whether handling macros here; or the result of a given hook to handle it.

    Allows macros of the given key to be handled by external named hooks, to replace any part of the functionality here in overall or granular ways.

    The macro names checked in this module are found in hooks.

    Parameters

    • Optionalstate: any

      Any object whose properties may handle macros.

    • Optionalkey: string

      Any name to check granularly within macros. See hooks.

    • Optionalon: string = ''

      Any further macro name specifier; if given, key itself and with this specifier are checked (i.e: key then key+'_'+on).

    • Optionalmacros:
          | string
          | false
          | {}
          | ((...: any[]) => null | string) = state.macros

      How macros should be handled, according to their type, in order of precedence:

      • nullish: macros to be handled here, nullish returned.
      • true: macros to be handled here, nullish returned.
      • falsey: no macros to be handled here, empty '' string returned.
      • string: no macros to be handled here, this hook value's used instead.
      • function: external hasMacros-like function hook, called with macros(state, key, on, macros), the returned value used as shown here.
      • object: recurses with any value at the given key, with hasMacros(state, key, on, macros[key]).
      • Otherwise, macros to be handled here, nullish returned.

    Returns null | string

    Either the result of the macros handled elsewhere, or nullish if macros should be handled here.

    hooks