Skip to content

Commit

Permalink
fix: comply with no-var rule
Browse files Browse the repository at this point in the history
Automated changes.
  • Loading branch information
Eli Skeggs committed Feb 4, 2020
1 parent 147d5a9 commit 54178ab
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import babel from 'rollup-plugin-babel';

var pkg = require('./package.json');
const pkg = require('./package.json');

export default {
entry: 'src/index.js',
Expand Down
8 changes: 4 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var supportedOperators = [
const supportedOperators = [
'contains',
'does not contain',
'is',
Expand Down Expand Up @@ -147,15 +147,15 @@ function matchesEnd(regexStr) {
}

// Copied from https://github.com/sindresorhus/escape-string-regexp/blob/master/index.js
var charsToEscape = ['|', '\\', '{', '}', '(', ')', '[', ']', '^', '$', '+', '*', '?', '.'];
const charsToEscape = ['|', '\\', '{', '}', '(', ')', '[', ']', '^', '$', '+', '*', '?', '.'];

function escapeRegex(str) {
var escapedChars = charsToEscape.map((char) => `\\${char}`);
const escapedChars = charsToEscape.map((char) => `\\${char}`);
return str.replace(new RegExp(`(${escapedChars.join('|')})`, 'g'), '\\$&');
}

function unescapeRegex(regexStr) {
var escapedChars = charsToEscape.map((char) => `\\\\\\${char}`);
const escapedChars = charsToEscape.map((char) => `\\\\\\${char}`);
return regexStr.replace(new RegExp(`(${escapedChars.join('|')})`, 'g'), (match) =>
match.slice(1)
);
Expand Down

0 comments on commit 54178ab

Please sign in to comment.