(examplesPath: string)
| 32 | const NAME_SUBSTUTION_PATTERN = /_/g; |
| 33 | |
| 34 | function readExamples(examplesPath: string): SourceEntry[] { |
| 35 | return fs.readdirSync(examplesPath).flatMap(folder => { |
| 36 | const folderPath = path.join(examplesPath, folder); |
| 37 | return fs.readdirSync(folderPath).map(file => { |
| 38 | const filePath = path.join(folderPath, file); |
| 39 | const fileName = path.parse(filePath).name; |
| 40 | return { |
| 41 | lang: folder, |
| 42 | name: fileName.replaceAll(NAME_SUBSTUTION_PATTERN, ' '), |
| 43 | path: filePath, |
| 44 | file: fileName, |
| 45 | }; |
| 46 | }); |
| 47 | }); |
| 48 | } |
| 49 | |
| 50 | export class BuiltinSource implements Source { |
| 51 | readonly name = 'Examples'; |
no test coverage detected