@cartridge-engine/keyboard-engine
    Preparing search index...

    Function checkWhen

    • Evaluate a when condition — either a function () => boolean, a string referencing a named condition, or undefined (always passes).

      When when is a string and the named condition has not been registered, this throws a descriptive error so the missing addCondition(id, ...) call is caught immediately at key-press time.

      Parameters

      • when: string | (() => boolean) | undefined

        The condition to evaluate.

      • conditions: Map<string, boolean>

        The conditions map from the pipeline context.

      Returns boolean

      The resolved boolean value of the condition.

      If when is a string referencing an unregistered condition.

      const conditions = new Map([['isEditing', true]]);

      checkWhen('isEditing', conditions); // true
      checkWhen(() => false, conditions); // false
      checkWhen(undefined, conditions); // true (no condition = pass)