(prompts)
| 1620 | } |
| 1621 | |
| 1622 | function applyPermuteOperator(prompts) { |
| 1623 | // prompts is array of input, trimmed, filtered and split by \n |
| 1624 | let promptsToMake = [] |
| 1625 | prompts.forEach((prompt) => { |
| 1626 | let promptMatrix = prompt.split("|") |
| 1627 | prompt = promptMatrix.shift().trim() |
| 1628 | promptsToMake.push(prompt) |
| 1629 | |
| 1630 | promptMatrix = promptMatrix.map((p) => p.trim()) |
| 1631 | promptMatrix = promptMatrix.filter((p) => p !== "") |
| 1632 | |
| 1633 | if (promptMatrix.length > 0) { |
| 1634 | let promptPermutations = permutePrompts(prompt, promptMatrix) |
| 1635 | promptsToMake = promptsToMake.concat(promptPermutations) |
| 1636 | } |
| 1637 | }) |
| 1638 | |
| 1639 | return promptsToMake |
| 1640 | } |
| 1641 | |
| 1642 | // returns how many prompts would have to be made with the given prompts |
| 1643 | function applyPermuteOperatorNumber(prompts) { |
no test coverage detected