UNPKG

@splitsoftware/splitio-commons

Version:
21 lines (20 loc) 864 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.partOfSetMatcherContext = void 0; var lang_1 = require("../../utils/lang"); function partOfSetMatcherContext(ruleAttr) { return function partOfMatcher(runtimeAttr) { // To be part of the length should be minor or equal. var isPartOf = runtimeAttr.length <= ruleAttr.length; var _loop_1 = function (i) { // If the length says is possible, we iterate until we prove otherwise or we check all elements. if ((0, lang_1.findIndex)(ruleAttr, function (e) { return e === runtimeAttr[i]; }) < 0) isPartOf = false; }; for (var i = 0; i < runtimeAttr.length && isPartOf; i++) { _loop_1(i); } return isPartOf; }; } exports.partOfSetMatcherContext = partOfSetMatcherContext;