Skip to content

COMPOSED_HANDLER

reference
1 min readUpdated

Kind: Constant

Source: src/utils/constants.ts

Part of: Utils

Constant used to mark a composed handler.

COMPOSED_HANDLER is a shared marker for handlers created through composition. Code that creates or inspects composed handlers can use this constant to apply and detect the same marker consistently.

Definition

ts
'__COMPOSED_HANDLER'

Value

ts
'__COMPOSED_HANDLER'

Diagram

mermaid
graph LR
  A[Handler composition] --> B[Composed handler]
  B --> C[COMPOSED_HANDLER marker]
  C --> D[Handler detection logic]

Usage

ts
import { COMPOSED_HANDLER } from './utils/constants';

function isComposedHandler(handler: object): boolean {
  return COMPOSED_HANDLER in handler;
}

// A handler created by composition is marked with COMPOSED_HANDLER.
if (isComposedHandler(handler)) {
  // Apply composed-handler behavior.
}

AI Coding Instructions

  • Import COMPOSED_HANDLER from src/utils/constants.ts instead of duplicating its marker value.
  • Apply the marker where handlers are composed, not where ordinary handlers are created.
  • Check for the marker before running behavior that is specific to composed handlers.
  • Keep marker creation and marker detection aligned so both paths use COMPOSED_HANDLER.

Used by

2 references from 2 files. Each is a place in this repository where the symbol is actually used — go read one rather than trusting an example.

Imported by (2)

  • HonoOptionssrc/hono-base.ts:46
  • isMiddlewaresrc/utils/handler.ts:8

Was this page helpful?

Download as PDF
COMPOSED_HANDLER — Hono (narrator proof)