(labels)
| 107 | } |
| 108 | |
| 109 | function normalizeIssueIntentLabelNames(labels) { |
| 110 | if (labels === undefined) { |
| 111 | return []; |
| 112 | } |
| 113 | if (!Array.isArray(labels)) { |
| 114 | const receivedType = labels === null ? "null" : typeof labels; |
| 115 | throw new Error(`Invalid labels. Expected an array of label names or label spec objects; received ${receivedType}.`); |
| 116 | } |
| 117 | |
| 118 | return labels.map((label, index) => { |
| 119 | if (typeof label === "string") { |
| 120 | return label; |
| 121 | } |
| 122 | const normalized = normalizeIssueIntentLabelSpecs([label]); |
| 123 | return normalized[0].name; |
| 124 | }); |
| 125 | } |
| 126 | |
| 127 | function getIssueIntentLabelNames(labelSpecs) { |
| 128 | return labelSpecs.map(label => label.name); |
no test coverage detected