mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-22 07:46:16 -04:00
add Merge (without Fork). Add flowcontrol setter to Operation
This commit is contained in:
parent
72d943aca2
commit
bca73b496f
5 changed files with 353 additions and 298 deletions
|
@ -274,6 +274,15 @@ class Operation {
|
|||
return this._flowControl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set whether this Operation is a flowcontrol op.
|
||||
*
|
||||
* @param {boolean} value
|
||||
*/
|
||||
set flowControl(value) {
|
||||
this._flowControl = !!value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default Operation;
|
||||
|
|
46
src/core/operations/Merge.mjs
Normal file
46
src/core/operations/Merge.mjs
Normal file
|
@ -0,0 +1,46 @@
|
|||
/**
|
||||
* @author n1474335 [n1474335@gmail.com]
|
||||
* @copyright Crown Copyright 2018
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
|
||||
import Operation from "../Operation";
|
||||
|
||||
/**
|
||||
* Merge operation
|
||||
*/
|
||||
class Merge extends Operation {
|
||||
|
||||
/**
|
||||
* Merge constructor
|
||||
*/
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
this.name = "Merge";
|
||||
this.flowControl = true;
|
||||
this.module = "Default";
|
||||
this.description = "Consolidate all branches back into a single trunk. The opposite of Fork.";
|
||||
this.inputType = "string";
|
||||
this.outputType = "string";
|
||||
this.args = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge operation.
|
||||
*
|
||||
* @param {Object} state - The current state of the recipe.
|
||||
* @param {number} state.progress - The current position in the recipe.
|
||||
* @param {Dish} state.dish - The Dish being operated on.
|
||||
* @param {Operation[]} state.opList - The list of operations in the recipe.
|
||||
* @returns {Object} The updated state of the recipe.
|
||||
*/
|
||||
run(state) {
|
||||
// No need to actually do anything here. The fork operation will
|
||||
// merge when it sees this operation.
|
||||
return state;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default Merge;
|
|
@ -23,7 +23,7 @@ class Register extends Operation {
|
|||
this.module = "Default";
|
||||
this.description = "Extract data from the input and store it in registers which can then be passed into subsequent operations as arguments. Regular expression capture groups are used to select the data to extract.<br><br>To use registers in arguments, refer to them using the notation <code>$Rn</code> where n is the register number, starting at 0.<br><br>For example:<br>Input: <code>Test</code><br>Extractor: <code>(.*)</code><br>Argument: <code>$R0</code> becomes <code>Test</code><br><br>Registers can be escaped in arguments using a backslash. e.g. <code>\\$R0</code> would become <code>$R0</code> rather than <code>Test</code>.";
|
||||
this.inputType = "string";
|
||||
this.outputType = "string";g
|
||||
this.outputType = "string";
|
||||
this.args = [
|
||||
{
|
||||
"name": "Extractor",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue