| 117 | } |
| 118 | |
| 119 | const settings = (documents: readonly Config.Entry[]) => { |
| 120 | const configured = documents |
| 121 | .filter((entry): entry is Config.Document => entry.type === "document") |
| 122 | .flatMap((entry) => (entry.info.compaction ? [entry.info.compaction] : [])) |
| 123 | return configured.reduce<Settings>( |
| 124 | (result, current) => ({ |
| 125 | auto: current.auto ?? result.auto, |
| 126 | buffer: current.buffer ?? result.buffer, |
| 127 | tokens: current.keep?.tokens ?? result.tokens, |
| 128 | }), |
| 129 | { auto: true, buffer: DEFAULT_BUFFER, tokens: DEFAULT_KEEP_TOKENS }, |
| 130 | ) |
| 131 | } |
| 132 | |
| 133 | const select = ( |
| 134 | entries: readonly Entry[], |