namirasoft-core
Advanced tools
Comparing version 1.3.6 to 1.3.7
export declare class FileOperation { | ||
static findUp(fileName: string): string[]; | ||
static foreachFolder(base: string, handler: (base: string, sub: string, full: string, folder: boolean) => Promise<void>, folders?: boolean, files?: boolean): Promise<void>; | ||
static foreach(base: string, handler: (base: string, sub: string, name: string, isFolder: boolean) => Promise<boolean | void>, folders?: boolean, files?: boolean): Promise<void>; | ||
} |
@@ -38,3 +38,3 @@ "use strict"; | ||
} | ||
static foreachFolder(base, handler, folders = true, files = true) { | ||
static foreach(base, handler, folders = true, files = true) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -48,4 +48,8 @@ function recursive(base, sub) { | ||
if (fs.statSync(p).isDirectory()) { | ||
if (folders) | ||
yield handler(base, sub, folder, true); | ||
if (folders) { | ||
let stop = yield handler(base, sub, folder, true); | ||
if (stop) | ||
continue; | ||
} | ||
; | ||
yield recursive(base, s); | ||
@@ -52,0 +56,0 @@ } |
@@ -11,3 +11,3 @@ { | ||
"private": false, | ||
"version": "1.3.6", | ||
"version": "1.3.7", | ||
"main": "./dist/index.js", | ||
@@ -14,0 +14,0 @@ "types": "./dist/index.d.ts", |
@@ -30,3 +30,3 @@ let fs: any; | ||
} | ||
static async foreachFolder(base: string, handler: (base: string, sub: string, full: string, folder: boolean) => Promise<void>, folders: boolean = true, files: boolean = true) | ||
static async foreach(base: string, handler: (base: string, sub: string, name: string, isFolder: boolean) => Promise<boolean | void>, folders: boolean = true, files: boolean = true) | ||
{ | ||
@@ -43,3 +43,7 @@ async function recursive(base: string, sub: string) | ||
if (folders) | ||
await handler(base, sub, folder, true); | ||
{ | ||
let stop = await handler(base, sub, folder, true); | ||
if (stop) | ||
continue; | ||
}; | ||
await recursive(base, s); | ||
@@ -46,0 +50,0 @@ } |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
300251
3652