mirror of
https://github.com/qvacua/vimr.git
synced 2024-12-26 07:13:24 +03:00
Refactor slightly
This commit is contained in:
parent
25f44ca1de
commit
b0ec35bb1d
@ -49,8 +49,8 @@ class FileUtils {
|
||||
}
|
||||
|
||||
let pathComps = urls.map { $0.pathComponents }
|
||||
let min = pathComps.reduce(pathComps[0].count) { (result, comps) in result < comps.count ? result : comps.count }
|
||||
let pathCompsOnlyMin = pathComps.map { Array($0[0..<min]) }
|
||||
let min = pathComps.map { $0.count }.min()!
|
||||
let pathCompsOnlyMin = pathComps.map { $0[0..<min] }
|
||||
let commonIdx = (0..<min).reversed().reduce(min - 1) { (result, idx) in
|
||||
if Set(pathCompsOnlyMin.map { $0[idx] }).count > 1 {
|
||||
return idx - 1
|
||||
|
Loading…
Reference in New Issue
Block a user