Skip to content
From 0.5.0 the packages continue as @cqrs-ddd, documented at aristoteliss.github.io/ddd-cqrs; NestJS applications add @cqrs-ddd/nestjs. This site documents the 0.4.x line.

escapeKeySegment

escapeKeySegment(value): string

Defined in: key-segment.ts:34

Escapes the structural characters of a :-joined composite key.

Joining raw values with : makes two different tuples collapse into one key whenever a value contains the separator:

['a:b', 'c'] → "a:b:c"
['a', 'b:c'] → "a:b:c" ← same key, different callers

Identifiers that reach a key are routinely email addresses, external subject claims and composite IDs. A collision means two callers share a rate-limit bucket or a cache entry.

The backslash is escaped first so that an input already containing one cannot be used to forge a separator.

string

string