feat: add pair to worflow

This commit is contained in:
karishmas6
2024-06-08 00:15:52 +05:30
parent 54dc526abe
commit 665c5a2cf1

View File

@@ -325,5 +325,18 @@ export class WorkflowGenerator {
}
};
public addPairToWorkflow = (index: number, pair: WhereWhatPair) => {
if (index === this.workflowRecord.workflow.length) {
this.workflowRecord.workflow.unshift(pair);
logger.log('debug', `pair ${index}: Added to workflow file.`);
} else if (index < this.workflowRecord.workflow.length && index >= 0) {
this.workflowRecord.workflow.splice(
this.workflowRecord.workflow.length - index , 0, pair);
} else {
logger.log('error', `Add pair ${index}: Index out of range.`);
}
};
}