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:
Henry Zhu
2021-03-27 12:59:34 -04:00
committed by GitHub
parent 6ac07a1647
commit 6b39bafab6
17 changed files with 52 additions and 84 deletions

View File

@@ -1,5 +0,0 @@
"use strict";
module.exports = process.env.BABEL_8_BREAKING
? require("escape-string-regexp")
: require("lodash/escapeRegExp");

View File

@@ -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