JSSM, a JavaScript state machine - the FSM for FSL
    Preparing search index...

    Function is_hook_complex_result

    • Type guard that narrows an unknown value to a HookComplexResult.

      A hook complex result is an object with at minimum a boolean pass field, and may optionally also carry replacement data / next_data fields that the machine should adopt if the hook passes. This helper is used by the hook-dispatch machinery to tell "hook returned a complex object" from "hook returned a bare boolean / null / undefined".

      is_hook_complex_result({ pass: true });                 // true
      is_hook_complex_result({ pass: false, data: { x: 1 }}); // true
      is_hook_complex_result(true); // false
      is_hook_complex_result(null); // false
      is_hook_complex_result({ other: 'thing' }); // false

      Type Parameters

      • mDT

        The type of the machine data member; usually omitted.

      Parameters

      • hr: unknown

        The value to test.

      Returns hr is HookComplexResult<mDT>

      true if hr is a non-null object with a boolean pass field; false otherwise. When true, TypeScript narrows hr to HookComplexResult<mDT>.