.config/utils.js
function readFiles(filePath, fileType, callback) {
    if (path_1.extname(filePath) === fileType) {
        callback(filePath);
    }
    else if (fs_1.lstatSync(filePath).isDirectory()) {
        // src is directory
        var filesOrDirectories = fs_1.readdirSync(filePath);
        filesOrDirectories.map(function (fileName) {
            var fileOrDirectory = path_1.join(filePath, fileName);
            readFiles(fileOrDirectory, fileType, callback);
        });
    }
}
function readFiles(filePath, fileType, callback) {
    if (path_1.extname(filePath) === fileType) {
        callback(filePath);
    }
    else if (fs_1.lstatSync(filePath).isDirectory()) {
        // src is directory
        var filesOrDirectories = fs_1.readdirSync(filePath);
        filesOrDirectories.map(function (fileName) {
            var fileOrDirectory = path_1.join(filePath, fileName);
            readFiles(fileOrDirectory, fileType, callback);
        });
    }
}
function readFiles ( filePath , fileType , callback ) { if ( path_1 . extname ( filePath ) === fileType ) { callback ( filePath ) ; } else if ( fs_1 . lstatSync ( filePath ) . isDirectory ( ) ) { // src is directory var filesOrDirectories = fs_1 . readdirSync ( filePath ) ; filesOrDirectories . map ( function ( fileName ) { var fileOrDirectory = path_1 . join ( filePath , fileName ) ; readFiles ( fileOrDirectory , fileType , callback ) ; } ) ; } }
Loop over all files from directory and sub-directories
Loop over all files from directory and sub - directories