( title: string, template: Template, index: number, )
| 14 | export type Headings = Array<string>; |
| 15 | |
| 16 | export const interpolateVariables = ( |
| 17 | title: string, |
| 18 | template: Template, |
| 19 | index: number, |
| 20 | ): string => |
| 21 | title |
| 22 | .replaceAll( |
| 23 | new RegExp(`\\$(${Object.keys(template).join('|')})[.\\w]*`, 'g'), |
| 24 | match => { |
| 25 | const keyPath = match.slice(1).split('.'); |
| 26 | const value = getPath(template, keyPath); |
| 27 | |
| 28 | return isPrimitive(value) |
| 29 | ? String(value) |
| 30 | : pretty(value, {maxDepth: 1, min: true}); |
| 31 | }, |
| 32 | ) |
| 33 | .replace('$#', `${index}`); |
| 34 | |
| 35 | /* eslint import-x/export: 0*/ |
| 36 | export function getPath< |
no test coverage detected