Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private initializeExtensionCodec() {
const codec = new ExtensionCodec();
Metadata.forEach(({ constructor }, id: number): void => {
codec.register({
type: id,
encode: (input: any) => {
if (input instanceof constructor) {
return encode(input.data);
}
return null;
},
decode: data => {
return new constructor({
transport: this,
client: this.client,
data: decode(data),
});