* @param {number} depth depth * @param {string} text text * @param {number} currentDepth current depth * @returns {NestedRecord<string> | string} generated code
(depth, text, currentDepth = 0)
| 18 | * @returns {NestedRecord<string> | string} generated code |
| 19 | */ |
| 20 | function generateData(depth, text, currentDepth = 0) { |
| 21 | if (currentDepth >= depth) { |
| 22 | return text; |
| 23 | } |
| 24 | |
| 25 | /** @type {NestedRecord<string>} */ |
| 26 | const obj = {}; |
| 27 | obj[`${LEVEL_PREFIX}${currentDepth}`] = generateData( |
| 28 | depth, |
| 29 | text, |
| 30 | currentDepth + 1 |
| 31 | ); |
| 32 | return obj; |
| 33 | } |
| 34 | |
| 35 | export async function setup() { |
| 36 | const __dirname = dirname(fileURLToPath(import.meta.url)); |