Function: encodeCmcd()
ts
function encodeCmcd(cmcd, options?): string;Defined in: encodeCmcd.ts:21
Encode a CMCD object to a string.
Parameters
cmcd
The CMCD object to encode.
options?
CmcdEncodeOptions = {}
Options for encoding.
Returns
string
The encoded CMCD string.
See
Example
ts
const input = { br: [1000], 'com.example-hello': 'world', ec: ['ERR001', 'ERR002'], su: true }
const options = { version: 2 as const, reportingMode: CmcdReportingMode.REQUEST }
equal(
encodeCmcd(input, options),
'br=(1000),com.example-hello="world",ec=("ERR001" "ERR002"),su,v=2',
)