compose

cart · /core·function

Koa-style middleware composer: each layer wraps the next in registration order. With compose(a, b)(terminal), execution flows a → b → terminal and unwinds in reverse.

Signature

@nordcom/commerce-cart

Parameters

NameTypeDescription
middlewareCartMiddleware[]

Returns

A higher-order function that wraps a terminal into a single composed .

Example

const pipeline = compose(logger(), retry({ attempts: 3, backoffMs: 100 }));
const run = pipeline(terminal);
await run({ kind: 'add-line', variantId: 'v_123', quantity: 1 }, ctx);

RunCartAdapterContractOpts runCartAdapterContract CartCapabilityUnsupportedError CartError CartNotFoundError CartProviderError CartUserError CartAdapter

Sourcecompose.ts:47Edit the JSDoc directly

On this page