Skip to content

Commit

Permalink
fix lookbehind regex on safari
Browse files Browse the repository at this point in the history
  • Loading branch information
Di Zhang authored and Alan-Cha committed Jun 11, 2021
1 parent 26b3469 commit 7ee12ba
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/provide-variables.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/provide-variables.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/provide-variables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ export function matchVarName(query: string, candidates: string[]): string {
return query
}

const queryParts = query.split(/(?<!__)__/g)
const queryParts = query.split(/__(?!__)/g)
if (!(queryParts.length === 2 || queryParts.length === 3)) {
throw new Error(`Invalid variable name query: ${query}`)
}

for (let candidate of candidates) {
const candidateParts = candidate.split(/(?<!__)__/g)
const candidateParts = candidate.split(/__(?!__)/g)
if (!(candidateParts.length === 2 || candidateParts.length === 3)) {
throw new Error(`Invalid variable name: ${candidate}`)
}
Expand Down

0 comments on commit 7ee12ba

Please sign in to comment.