mirror of
https://github.com/Viren070/AIOStreams.git
synced 2025-12-01 23:14:04 +01:00
feat: add 'not' function to BaseConditionParser for filtering streams
This commit is contained in:
@@ -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> {
|
||||
|
||||
Reference in New Issue
Block a user