mirror of
https://github.com/swc-project/swc.git
synced 2024-12-19 03:31:45 +03:00
b7ae896bbd
swc_ecma_transforms_compat: - Handle all accesses to private class properties. (#1333) - block_scoping: Inject variable correctly. (#1231) - Handle async arrow function correctly. (#1341)
21 lines
520 B
JavaScript
21 lines
520 B
JavaScript
function combineOverlappingMatches(matches) {
|
|
let hasOverlaps = false
|
|
|
|
for (let i = matches.length - 1; i >= 0; i--) {
|
|
let currentMatch = matches[i]
|
|
let overlap = matches.find(match => {
|
|
return match !== currentMatch && match.itemsType === currentMatch.itemsType
|
|
})
|
|
|
|
if (overlap) {
|
|
hasOverlaps = true
|
|
matches.splice(i, 1)
|
|
}
|
|
}
|
|
|
|
if (hasOverlaps) {
|
|
combineOverlappingMatches(matches)
|
|
}
|
|
}
|
|
|
|
combineOverlappingMatches([1]) |