(
fields: { positioned: ProcessedField["positioned"] }[]
)
| 119 | } |
| 120 | |
| 121 | export function buildNestedAssemblyOr( |
| 122 | fields: { positioned: ProcessedField["positioned"] }[] |
| 123 | ): ArrayJoinInput<string> { |
| 124 | const positionedFields: string[] = fields.map((f) => f.positioned); |
| 125 | const lastIndex = positionedFields.length - 1; |
| 126 | const getChunk = (index: number) => { |
| 127 | if (index < lastIndex) { |
| 128 | const nextChunk = getChunk(index + 1); |
| 129 | return [ |
| 130 | "or(", |
| 131 | [ |
| 132 | `${positionedFields[index]},`, |
| 133 | ...(Array.isArray(nextChunk) ? nextChunk : [nextChunk]), |
| 134 | ], |
| 135 | `)`, |
| 136 | ]; |
| 137 | } |
| 138 | return positionedFields[index]; |
| 139 | }; |
| 140 | return toArray(getChunk(0)); |
| 141 | } |
no test coverage detected