@splitsoftware/splitio-commons
Version:
Split JavaScript SDK common components
21 lines (20 loc) • 856 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.equalToSetMatcherContext = void 0;
var lang_1 = require("../../utils/lang");
function equalToSetMatcherContext(ruleAttr) {
return function equalToSetMatcher(runtimeAttr) {
// Length being the same is the first condition.
var isEqual = runtimeAttr.length === ruleAttr.length;
var _loop_1 = function (i) {
// if length is the same we check that all elements are present in the other collection.
if ((0, lang_1.findIndex)(ruleAttr, function (e) { return e === runtimeAttr[i]; }) < 0)
isEqual = false;
};
for (var i = 0; i < runtimeAttr.length && isEqual; i++) {
_loop_1(i);
}
return isEqual;
};
}
exports.equalToSetMatcherContext = equalToSetMatcherContext;