mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
31 lines
753 B
JavaScript
31 lines
753 B
JavaScript
"use strict";
|
|
|
|
const Expression = require('./expression');
|
|
|
|
class AndExp extends Expression {
|
|
static of(subExpressions) {
|
|
subExpressions = subExpressions.filter(exp => !!exp);
|
|
|
|
if (subExpressions.length === 1) {
|
|
return subExpressions[0];
|
|
} else if (subExpressions.length > 0) {
|
|
return new AndExp(subExpressions);
|
|
}
|
|
}
|
|
|
|
constructor(subExpressions) {
|
|
super();
|
|
this.subExpressions = subExpressions;
|
|
}
|
|
|
|
async execute(inputNoteSet, searchContext) {
|
|
for (const subExpression of this.subExpressions) {
|
|
inputNoteSet = await subExpression.execute(inputNoteSet, searchContext);
|
|
}
|
|
|
|
return inputNoteSet;
|
|
}
|
|
}
|
|
|
|
module.exports = AndExp;
|