Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
thecrypticace committed Apr 27, 2022
1 parent e06d194 commit cc30777
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/lib/defaultExtractor.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,15 @@ function clipAtBalancedParens(input) {

// We can't use lookbehind assertions because we have to support Safari
// So, instead, we've emulated it using capture groups and we'll re-work the matches to accommodate
matches = Array.from(matches).flatMap(match => {
matches = Array.from(matches).flatMap((match) => {
const [_, ...groups] = match

return groups.map((group, idx) => Object.assign([], {
...match,
index: match.index + idx,
0: group,
}))
return groups.map((group, idx) =>
Object.assign([], match, {
index: match.index + idx,
0: group,
})
)
})

for (let match of matches) {
Expand Down

0 comments on commit cc30777

Please sign in to comment.