joinSegments

tagtree · /core·functionthrows When

Combines an ordered list of raw segments into a dotted-path cache tag, encoding each segment before joining so no raw value can break the path structure.

Signature

@nordcom/commerce-tagtree
function joinSegments(segments: readonly string | number[]): string;

Parameters

NameTypeDescription
segmentsreadonly string | number[]

Returns

A dotted-path string suitable for use as a tagtree cache tag.

Throws

When
any segment encodes to an empty string, which would produce an ambiguous tag.

Example

joinSegments(['commerce', 'shop.example.com', 'product', '123']);
// 'commerce.shop%2Eexample%2Ecom.product.123'

ContractTestOptions runAdapterContract AdapterCtx CacheAdapter CacheInstance CacheKey CacheSchema CacheSchemaShape

Sourceencode.ts:35Edit the JSDoc directly

On this page