summary refs log tree commit diff
path: root/src/opcodes/instanceOf.ts
blob: b0c9bf26dba847681901d389fc35b21e937fd197 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
import { instanceOf } from "lambert-server";
import { CLOSECODES } from "../util/Constants";
import WebSocket from "../util/WebSocket";

export function check(this: WebSocket, schema: any, data: any) {
	try {
		return instanceOf(schema, data);
	} catch (error) {
		// invalid identify struct
		this.close(CLOSECODES.Decode_error);
		return false;
	}
}