11import * as fs from 'fs' ;
22import * as path from 'path' ;
3- import { ProcessRerunError } from './error' ;
4-
5- const getFilesList = function ( dir : string , fileList : string [ ] = [ ] , directoryToSkip : string [ ] = [ ] , ignoreSubDirs ?: boolean ) : string [ ] {
3+ import { ProcessRerunError } from './error' ;
4+
5+ const getFilesList = function (
6+ dir : string ,
7+ fileList : string [ ] = [ ] ,
8+ directoryToSkip : string [ ] = [ ] ,
9+ ignoreSubDirs ?: boolean ,
10+ ) : string [ ] {
611 if ( ! fs . existsSync ( dir ) ) {
712 throw new ProcessRerunError ( 'FileSystem' , `${ dir } does not exists` ) ;
813 }
914
1015 const files = fs . readdirSync ( dir ) ;
1116
12- files . forEach ( function ( file ) {
17+ files . forEach ( function ( file ) {
1318 const isDirr = fs . statSync ( path . join ( dir , file ) ) . isDirectory ( ) ;
1419
1520 const shouldBeExcluded =
@@ -32,15 +37,11 @@ const getFilesList = function(dir: string, fileList: string[] = [], directoryToS
3237} ;
3338
3439function getPollTime ( timeVal : any ) : number {
35- return typeof timeVal === 'number' && ! isNaN ( timeVal ) && isFinite ( timeVal ) ? timeVal : 1000 ;
40+ return typeof timeVal === 'number' && ! Number . isNaN ( timeVal ) && Number . isFinite ( timeVal ) ? timeVal : 1000 ;
3641}
3742
3843function sleep ( time : number ) : Promise < void > {
39- return new Promise ( ( res ) => setTimeout ( res , time ) ) ;
44+ return new Promise ( res => setTimeout ( res , time ) ) ;
4045}
4146
42- export {
43- getPollTime ,
44- sleep ,
45- getFilesList ,
46- } ;
47+ export { getPollTime , sleep , getFilesList } ;
0 commit comments