CyberChef/src/core/lib/FlowControl.mjs

21 lines
506 B
JavaScript
Raw Normal View History

2018-05-18 13:52:16 +02:00
/**
* Flow control functions
*
* @author d98762625 [d98762625@gmail.com]
* @copyright Crown Copyright 2018
* @license Apache-2.0
*/
2018-05-18 13:50:23 +02:00
/**
* Returns the index of a label.
*
2018-05-21 12:12:58 +02:00
* @param {Object} state - The current state of the recipe.
2018-05-18 13:52:16 +02:00
* @param {string} name - The label name to look for.
2018-05-18 13:50:23 +02:00
* @returns {number}
*/
export function getLabelIndex(name, state) {
return state.opList.findIndex((operation) => {
return (operation.name === "Label") && (name === operation.ingValues[0]);
});
}