CyberChef/src/core/lib/FlowControl.mjs

23 lines
486 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.
*
* @private
* @param {Object} state
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]);
});
}