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
mermaidgraph LR A[Handler composition] --> B[Composed handler] B --> C[COMPOSED_HANDLER marker] C --> D[Handler detection logic]
Usage
tsimport { 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_HANDLERfromsrc/utils/constants.tsinstead 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)
HonoOptions—src/hono-base.ts:46isMiddleware—src/utils/handler.ts:8
Was this page helpful?