Innovenergy_trunk/frontend/node_modules/testcafe/lib/utils/match-collection.js

21 lines
2.1 KiB
JavaScript
Raw Permalink Normal View History

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const lodash_1 = require("lodash");
// NOTE: this method will duplicate the matching items
// currently cookies-tests use incorrect behavior of this method
// the method and cookies-tests should be rewritten
function matchCollection(items, filters) {
if (!filters.length)
return items;
const result = [];
for (const item of items) {
for (const filter of filters) {
if ((0, lodash_1.isMatch)(item, filter))
result.push(item);
}
}
return result;
}
exports.default = matchCollection;
module.exports = exports.default;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWF0Y2gtY29sbGVjdGlvbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlscy9tYXRjaC1jb2xsZWN0aW9uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsbUNBQWlDO0FBRWpDLHNEQUFzRDtBQUN0RCxnRUFBZ0U7QUFDaEUsbURBQW1EO0FBQ25ELFNBQXdCLGVBQWUsQ0FBRSxLQUFlLEVBQUUsT0FBaUI7SUFDdkUsSUFBSSxDQUFDLE9BQU8sQ0FBQyxNQUFNO1FBQ2YsT0FBTyxLQUFLLENBQUM7SUFFakIsTUFBTSxNQUFNLEdBQUcsRUFBRSxDQUFDO0lBRWxCLEtBQUssTUFBTSxJQUFJLElBQUksS0FBSyxFQUFFO1FBQ3RCLEtBQUssTUFBTSxNQUFNLElBQUksT0FBTyxFQUFFO1lBQzFCLElBQUksSUFBQSxnQkFBTyxFQUFDLElBQUksRUFBRSxNQUFNLENBQUM7Z0JBQ3JCLE1BQU0sQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLENBQUM7U0FDekI7S0FDSjtJQUVELE9BQU8sTUFBTSxDQUFDO0FBQ2xCLENBQUM7QUFkRCxrQ0FjQyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGlzTWF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