Welcome to mirror list, hosted at ThFree Co, Russian Federation.

AndCondition.js « Condition « NextSearch « js « src - github.com/marius-wieschollek/passwords-webextension.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 8e4d36acbfe6c1ffba3981fe11ac3b4327bf7f1f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import AbstractSearchCondition from '@js/NextSearch/Condition/AbstractSearchCondition';

export default class AndCondition extends AbstractSearchCondition {

    get TYPE() {
        return 'and';
    }

    /**
     * @inheritDoc
     */
    evaluate(item) {
        let result = {matches: 0, checks: 0, passed: true};

        for(let condition of this._conditions) {
            let partialResult = condition.evaluate(item);

            if(!partialResult.passed) return {passed: false};
            result.matches += partialResult.matches;
            result.checks += partialResult.checks;
        }

        return result;
    }
}