Website Structure
This commit is contained in:
parent
62812f2090
commit
71f0676a62
22365 changed files with 4265753 additions and 791 deletions
32
Frontend-Learner/node_modules/eslint-plugin-regexp/dist/utils/fix-simplify-quantifier.js
generated
vendored
Normal file
32
Frontend-Learner/node_modules/eslint-plugin-regexp/dist/utils/fix-simplify-quantifier.js
generated
vendored
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fixSimplifyQuantifier = fixSimplifyQuantifier;
|
||||
const regexp_ast_analysis_1 = require("regexp-ast-analysis");
|
||||
const regexp_ast_1 = require("./regexp-ast");
|
||||
function fixSimplifyQuantifier(quantifier, result, { fixReplaceNode }) {
|
||||
const ancestor = (0, regexp_ast_analysis_1.getClosestAncestor)(quantifier, ...result.dependencies);
|
||||
let replacement;
|
||||
if (quantifier.min === 0) {
|
||||
replacement = "";
|
||||
}
|
||||
else if (quantifier.min === 1) {
|
||||
replacement = quantifier.element.raw;
|
||||
}
|
||||
else {
|
||||
replacement =
|
||||
quantifier.element.raw +
|
||||
(0, regexp_ast_1.quantToString)({
|
||||
min: quantifier.min,
|
||||
max: quantifier.min,
|
||||
greedy: true,
|
||||
});
|
||||
}
|
||||
return [
|
||||
replacement,
|
||||
fixReplaceNode(ancestor, () => {
|
||||
return (ancestor.raw.slice(0, quantifier.start - ancestor.start) +
|
||||
replacement +
|
||||
ancestor.raw.slice(quantifier.end - ancestor.start));
|
||||
}),
|
||||
];
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue