1
0
mirror of synced 2025-02-25 05:55:36 +01:00
CyberChef/src/core/operations/SetIntersection.mjs
2018-04-04 17:37:19 +01:00

34 lines
629 B
JavaScript

import SetOp from "./SetOps";
/**
*
*/
class SetIntersection extends SetOp {
/**
*
*/
constructor() {
super();
this.setOp = this.runIntersection;
this.name = "Set Intersection";
this.description = "Get the intersection of two sets";
}
/**
* Get the intersection of the two sets.
*
* @param {Object[]} a
* @param {Object[]} b
* @returns {Object[]}
*/
runIntersection(a, b) {
return a.filter((item) => {
return b.indexOf(item) > -1;
}).join(this.itemDelimiter);
}
}
export default SetIntersection;