Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function findActionOrCreate(action, release) {
let name = action.toLowerCase().trim();
name = name[0].toUpperCase() + name.substr(1);
let actionNode = select(`action[name=${name}]`, release);
if (actionNode) {
return actionNode;
}
actionNode = createAction({ name });
release.children.push(actionNode);
return actionNode;
}