UNPKG

@splitsoftware/splitio-commons

Version:
24 lines (23 loc) 746 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.returnDifference = exports.returnSetsUnion = exports.setToArray = void 0; function setToArray(set) { if (Array.from) return Array.from(set); var array = []; set.forEach(function (value) { array.push(value); }); return array; } exports.setToArray = setToArray; function returnSetsUnion(set, set2) { return new Set(setToArray(set).concat(setToArray(set2))); } exports.returnSetsUnion = returnSetsUnion; function returnDifference(list1, list2) { list1 = list1 || []; list2 = list2 || []; return list1.filter(function (item) { return list2.indexOf(item) === -1; }); } exports.returnDifference = returnDifference;