Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function analyseExtensionObject(buffer: Buffer, padding: number, offset: number, customOptions?: AnalyzePacketOptions) {
const stream = new BinaryStream(buffer);
let id;
let objMessage;
try {
id = decodeExpandedNodeId(stream);
objMessage = constructObject(id);
} catch (err) {
console.log(id);
console.log(err);
console.log("Cannot read decodeExpandedNodeId on stream " + stream.buffer.toString("hex"));
}
_internalAnalyzePacket(buffer, stream, objMessage, padding, customOptions, offset);
}
function constructEmptyExtensionObject(expandedNodeId: NodeId): ExtensionObject {
return constructObject(expandedNodeId as ExpandedNodeId);
}
Factory.prototype.constructObject = function (id) {
return factories.constructObject(id);
};
public constructObject(id: ExpandedNodeId): ExtensionObject {
const obj = constructObject(id);
if (!(obj instanceof ExtensionObject)) {
throw new Error("Internal Error constructObject");
}
return obj as ExtensionObject;
}
}