gpc-remove-duplicates
Version:
This GherKing Precompiler is responsible for having only a reasonable amount of tags and/or rows in each feature file.
23 lines • 756 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.TagSet = exports.removeDuplicates = void 0;
const ObjectSetType = require("object-set-type");
function removeDuplicates(tags, ...tagsToIgnore) {
if (!tags || !tags.length) {
return [];
}
const uniqueTags = Array.from(new TagSet(tags));
if (!tagsToIgnore.length) {
return uniqueTags;
}
const parentUniqueTags = new TagSet(tagsToIgnore);
return uniqueTags.filter((tag) => !parentUniqueTags.has(tag));
}
exports.removeDuplicates = removeDuplicates;
class TagSet extends ObjectSetType {
equals(a, b) {
return a.name === b.name && a.value === b.value;
}
}
exports.TagSet = TagSet;
//# sourceMappingURL=tag-set.js.map