Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | 1x 1x 1x 1x 1x | 'use strict'; import * as fs from 'fs'; import * as path from 'path'; import {each, filter} from 'lodash'; const executeOnFilesRecursively = (folder: string, execute: Function): void => { const children = fs.readdirSync(folder); const files = filter(children, (name) => !fs.lstatSync(path.join(folder, name)).isDirectory()); each(files, (file: string) => { const absoluteFilePath = path.join(folder, file); const obj: any = require(absoluteFilePath).default; execute(obj); }); const folders = filter(children, (name: string) => fs.lstatSync(path.join(folder, name)).isDirectory()); each(folders, (sub: string) => executeOnFilesRecursively(path.join(folder, sub), execute)); }; export default executeOnFilesRecursively; |