Remove lodash deps (#13057)
* inline escapeRegExp instead of using any dep * inline camelCase * replace merge with object spread * copy if array instead of using clone * inline isRegExp * review fixes! * remove escape-string-regexp from package.json and in test * add error for field defaults that are not primitives or empty arrays * replace merge with object spread * yarn
This commit is contained in:
@@ -1,5 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = process.env.BABEL_8_BREAKING
|
||||
? require("escape-string-regexp")
|
||||
: require("lodash/escapeRegExp");
|
||||
@@ -1,9 +1,6 @@
|
||||
// @flow
|
||||
import path from "path";
|
||||
|
||||
// $FlowIgnore
|
||||
import escapeRegExp from "./helpers/escape-regexp.cjs";
|
||||
|
||||
const sep = `\\${path.sep}`;
|
||||
const endSep = `(?:${sep}|$)`;
|
||||
|
||||
@@ -15,6 +12,10 @@ const starPatLast = `(?:${substitution}${endSep})`;
|
||||
const starStarPat = `${starPat}*?`;
|
||||
const starStarPatLast = `${starPat}*?${starPatLast}?`;
|
||||
|
||||
function escapeRegExp(string) {
|
||||
return string.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&");
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement basic pattern matching that will allow users to do the simple
|
||||
* tests with * and **. If users want full complex pattern matching, then can
|
||||
|
||||
Reference in New Issue
Block a user