File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -1047,7 +1047,7 @@ export function ls(optionsOrPaths?: unknown, ...paths: unknown[]): string[] {
1047
1047
1048
1048
// Flatten paths if the paths argument is array
1049
1049
if ( Array . isArray ( paths ) ) {
1050
- paths = paths . flat ( Infinity ) ;
1050
+ paths = flattenArray ( paths ) ;
1051
1051
}
1052
1052
1053
1053
// If the first argument is not options, then it is a path
@@ -1121,6 +1121,12 @@ export function ls(optionsOrPaths?: unknown, ...paths: unknown[]): string[] {
1121
1121
}
1122
1122
}
1123
1123
1124
+ function flattenArray ( arr : any [ ] ) : any [ ] {
1125
+ return arr . reduce ( ( flat , toFlatten ) => {
1126
+ return flat . concat ( Array . isArray ( toFlatten ) ? flattenArray ( toFlatten ) : toFlatten ) ;
1127
+ } , [ ] ) ;
1128
+ }
1129
+
1124
1130
type CopyOptionsVariants = OptionsPermutations < 'frn' > ;
1125
1131
1126
1132
/**
You can’t perform that action at this time.
0 commit comments