ts-mls
Version:
[](https://github.com/LukaJCB/ts-mls/actions/workflows/ci.yml) [](https://badge.fury.io/js/ts-mls) [ {
return (t) => (t ? prependPresenceOctet(encodeT(t)) : new Uint8Array([0x0]));
}
export function decodeOptional(decodeT) {
return (b, offset) => {
const presenceOctet = decodeUint8(b, offset)?.[0];
if (presenceOctet == 1) {
const result = decodeT(b, offset + 1);
return result === undefined ? undefined : [result[0], result[1] + 1];
}
else {
return [undefined, 1];
}
};
}
function prependPresenceOctet(v) {
return concatUint8Arrays(encodeUint8(0x1), v);
}
//# sourceMappingURL=optional.js.map