handle $oid

This commit is contained in:
Jan Prochazka
2022-12-30 12:24:05 +01:00
parent 380ab2e69e
commit d407c72f78
5 changed files with 35 additions and 5 deletions

View File

@@ -8,3 +8,15 @@ export function getPerspectiveMostNestedChildColumnName(columnName: string) {
const path = columnName.split('::');
return path[path.length - 1];
}
export function perspectiveValueMatcher(value1, value2): boolean {
if (value1?.$oid && value2?.$oid) return value1.$oid == value2.$oid;
if (Array.isArray(value1)) return !!value1.find(x => perspectiveValueMatcher(x, value2));
if (Array.isArray(value2)) return !!value2.find(x => perspectiveValueMatcher(value1, x));
return value1 == value2;
}
export function perspectiveValueMatcherSimple(value1, value2): boolean {
if (value1?.$oid && value2?.$oid) return value1.$oid == value2.$oid;
return value1 == value2;
}