mirror of
https://github.com/spacebarchat/server.git
synced 2026-10-22 17:32:30 +00:00
Fix backwards condition
This commit is contained in:
1 parent
2b9802200d
commit
781abf950a
1 file changed
+1
-1
@@ -96,7 +96,7 @@ export function instanceOf(type: any, value: any, { path = "", optional = false
|
||||
if (typeof value !== "object") throw `${path} must be a object`;
|
||||
|
||||
const filterset = new Set(Object.keys(type).map((x) => (x.startsWith(OPTIONAL_PREFIX) ? x.slice(OPTIONAL_PREFIX.length) : x)));
|
||||
const diff = Object.keys(value).filter((_) => filterset.has(_));
|
||||
const diff = Object.keys(value).filter((_) => !filterset.has(_));
|
||||
|
||||
if (diff.length) throw `Unknown key ${diff}`;
|
||||
|
||||
|
||||
Reference in new issue
Block a user