Skip to content

Commit e9d7d53

Browse files
committed
refactor Files function (utility.ts)
1 parent 4754b21 commit e9d7d53

File tree

1 file changed

+4
-16
lines changed

1 file changed

+4
-16
lines changed

src/utility.ts

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -34,22 +34,10 @@ export const Binary = function (override = false, binary = '7z') {
3434
* @return {string}
3535
*/
3636
export const Files = function (files: string | string[]): string {
37-
if (isUndefined(files)) {
38-
return '';
39-
}
40-
41-
let toProcess = '';
42-
43-
if (Array.isArray(files)) {
44-
files.forEach(function (f) {
45-
toProcess += '"' + f + '" ';
46-
});
47-
toProcess = toProcess.trim();
48-
} else {
49-
toProcess = '"' + files + '"';
50-
}
51-
52-
return toProcess;
37+
if (isUndefined(files)) return '';
38+
return (Array.isArray(files) ? files : [files])
39+
.map((file) => `"${file}"`)
40+
.join(' ');
5341
};
5442

5543
/**

0 commit comments

Comments
 (0)