feat: add 'not' function to BaseConditionParser for filtering streams

This commit is contained in:
Viren070
2025-06-21 02:20:15 +01:00
parent cc2f5f7608
commit 44d2c4c870
+13
View File
@@ -367,6 +367,19 @@ export abstract class BaseConditionParser {
}
return streams.length;
};
this.parser.functions.not = function (
streams: ParsedStream[],
originalStreams: ParsedStream[]
) {
if (!Array.isArray(originalStreams)) {
throw new Error(
"Please use one of 'totalStreams' or 'previousStreams' as the second argument"
);
}
const streamIds = new Set(streams.map((stream) => stream.id));
return originalStreams.filter((stream) => !streamIds.has(stream.id));
};
}
protected async evaluateCondition(condition: string): Promise<any> {