mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-21 07:16:17 -04:00
inital move of two ops
This commit is contained in:
parent
7ce1bf1048
commit
f491461a57
11 changed files with 244 additions and 213 deletions
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;
|
Loading…
Add table
Add a link
Reference in a new issue