(input)
| 218 | // list. Emits a normalised assertion array. |
| 219 | |
| 220 | function parseAssertions(input) { |
| 221 | if (!input) return []; |
| 222 | if (Array.isArray(input)) { |
| 223 | return input |
| 224 | .map((s, i) => String(s || '').trim()) |
| 225 | .filter(Boolean) |
| 226 | .map((text, i) => ({ id: newAssertionId(i), text, state: STATES.PENDING, evidence: null, last_check: null })); |
| 227 | } |
| 228 | const lines = String(input).split(/\r?\n/); |
| 229 | const out = []; |
| 230 | for (const raw of lines) { |
| 231 | const line = raw.trim(); |
| 232 | if (!line) continue; |
| 233 | // Strip leading bullet/number markers |
| 234 | const cleaned = line.replace(/^[-*]\s+/, '').replace(/^\d+[.)]\s+/, '').trim(); |
| 235 | if (!cleaned) continue; |
| 236 | out.push({ |
| 237 | id: newAssertionId(out.length), |
| 238 | text: cleaned, |
| 239 | state: STATES.PENDING, |
| 240 | evidence: null, |
| 241 | last_check: null, |
| 242 | }); |
| 243 | } |
| 244 | return out; |
| 245 | } |
| 246 | |
| 247 | module.exports = { |
| 248 | // constants |
no test coverage detected