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