( nextSteps: readonly NextStep[] | undefined, options: FormatNextStepOptions, )
| 103 | } |
| 104 | |
| 105 | export function serializeNextSteps( |
| 106 | nextSteps: readonly NextStep[] | undefined, |
| 107 | options: FormatNextStepOptions, |
| 108 | ): string[] | undefined { |
| 109 | if (!nextSteps || nextSteps.length === 0) { |
| 110 | return undefined; |
| 111 | } |
| 112 | |
| 113 | const serialized = [...nextSteps] |
| 114 | .sort((a, b) => (a.priority ?? 0) - (b.priority ?? 0)) |
| 115 | .map((step) => formatNextStep(step, options)) |
| 116 | .filter((step) => step.trim().length > 0); |
| 117 | |
| 118 | return serialized.length > 0 ? serialized : undefined; |
| 119 | } |
no test coverage detected