mirror of
https://github.com/gchq/CyberChef
synced 2025-12-14 07:13:18 +00:00
inital move of two ops
This commit is contained in:
33
src/core/operations/SetIntersection.mjs
Normal file
33
src/core/operations/SetIntersection.mjs
Normal file
@@ -0,0 +1,33 @@
|
||||
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;
|
||||
Reference in New Issue
Block a user