Skip to content

API reference / @chanx-js/client / core / formatPattern

Function: formatPattern() ​

ts
function formatPattern(
   pattern, 
   params?, 
   encode?
): string;

Defined in: packages/client/src/core/protocol.ts:91

Fill {name} placeholders in an address or topic pattern.

Pass encode for a URL, so a value cannot add path segments or a query. Topic strings are compared verbatim with the server's, so they are filled raw.

Parameters ​

ParameterType
patternstring
paramsRecord<string, string | number>
encode(value) => string

Returns ​

string

MIT licensed