lib,tools: remove unneeded escaping of /
The `/` character does not need to be escaped when occurring inside a character class in a regular expression. Remove such instances of escaping in the code base. PR-URL: https://github.com/nodejs/node/pull/9591 Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
This commit is contained in:
parent
c1133f41b6
commit
0f4c7b8c37
@ -44,7 +44,7 @@ const protocolPattern = /^([a-z0-9.+-]+:)/i;
|
|||||||
const portPattern = /:[0-9]*$/;
|
const portPattern = /:[0-9]*$/;
|
||||||
|
|
||||||
// Special case for a simple path URL
|
// Special case for a simple path URL
|
||||||
const simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/;
|
const simplePathPattern = /^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/;
|
||||||
|
|
||||||
const hostnameMaxLen = 255;
|
const hostnameMaxLen = 255;
|
||||||
// protocols that can allow "unsafe" and "unwise" chars.
|
// protocols that can allow "unsafe" and "unwise" chars.
|
||||||
|
@ -90,7 +90,7 @@ function loadGtoc(cb) {
|
|||||||
function toID(filename) {
|
function toID(filename) {
|
||||||
return filename
|
return filename
|
||||||
.replace('.html', '')
|
.replace('.html', '')
|
||||||
.replace(/[^\w\-]/g, '-')
|
.replace(/[^\w-]/g, '-')
|
||||||
.replace(/-+/g, '-');
|
.replace(/-+/g, '-');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -284,7 +284,7 @@ function linkJsTypeDocs(text) {
|
|||||||
// Handle types, for example the source Markdown might say
|
// Handle types, for example the source Markdown might say
|
||||||
// "This argument should be a {Number} or {String}"
|
// "This argument should be a {Number} or {String}"
|
||||||
for (i = 0; i < parts.length; i += 2) {
|
for (i = 0; i < parts.length; i += 2) {
|
||||||
typeMatches = parts[i].match(/\{([^\}]+)\}/g);
|
typeMatches = parts[i].match(/\{([^}]+)\}/g);
|
||||||
if (typeMatches) {
|
if (typeMatches) {
|
||||||
typeMatches.forEach(function(typeMatch) {
|
typeMatches.forEach(function(typeMatch) {
|
||||||
parts[i] = parts[i].replace(typeMatch, typeParser.toLink(typeMatch));
|
parts[i] = parts[i].replace(typeMatch, typeParser.toLink(typeMatch));
|
||||||
|
@ -31,7 +31,7 @@ function doJSON(input, filename, cb) {
|
|||||||
// <!-- type = module -->
|
// <!-- type = module -->
|
||||||
// This is for cases where the markdown semantic structure is lacking.
|
// This is for cases where the markdown semantic structure is lacking.
|
||||||
if (type === 'paragraph' || type === 'html') {
|
if (type === 'paragraph' || type === 'html') {
|
||||||
var metaExpr = /<!--([^=]+)=([^\-]+)-->\n*/g;
|
var metaExpr = /<!--([^=]+)=([^-]+)-->\n*/g;
|
||||||
text = text.replace(metaExpr, function(_0, k, v) {
|
text = text.replace(metaExpr, function(_0, k, v) {
|
||||||
current[k.trim()] = v.trim();
|
current[k.trim()] = v.trim();
|
||||||
return '';
|
return '';
|
||||||
@ -371,7 +371,7 @@ function parseListItem(item) {
|
|||||||
item.name = 'return';
|
item.name = 'return';
|
||||||
text = text.replace(retExpr, '');
|
text = text.replace(retExpr, '');
|
||||||
} else {
|
} else {
|
||||||
var nameExpr = /^['`"]?([^'`": \{]+)['`"]?\s*:?\s*/;
|
var nameExpr = /^['`"]?([^'`": {]+)['`"]?\s*:?\s*/;
|
||||||
var name = text.match(nameExpr);
|
var name = text.match(nameExpr);
|
||||||
if (name) {
|
if (name) {
|
||||||
item.name = name[1];
|
item.name = name[1];
|
||||||
@ -388,7 +388,7 @@ function parseListItem(item) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
text = text.trim();
|
text = text.trim();
|
||||||
var typeExpr = /^\{([^\}]+)\}/;
|
var typeExpr = /^\{([^}]+)\}/;
|
||||||
var type = text.match(typeExpr);
|
var type = text.match(typeExpr);
|
||||||
if (type) {
|
if (type) {
|
||||||
item.type = type[1];
|
item.type = type[1];
|
||||||
@ -551,7 +551,7 @@ var classMethExpr =
|
|||||||
/^class\s*method\s*:?[^.]+\.([^ .()]+)\([^)]*\)\s*?$/i;
|
/^class\s*method\s*:?[^.]+\.([^ .()]+)\([^)]*\)\s*?$/i;
|
||||||
var methExpr =
|
var methExpr =
|
||||||
/^(?:method:?\s*)?(?:[^.]+\.)?([^ .()]+)\([^)]*\)\s*?$/i;
|
/^(?:method:?\s*)?(?:[^.]+\.)?([^ .()]+)\([^)]*\)\s*?$/i;
|
||||||
var newExpr = /^new ([A-Z][a-zA-Z]+)\([^\)]*\)\s*?$/;
|
var newExpr = /^new ([A-Z][a-zA-Z]+)\([^)]*\)\s*?$/;
|
||||||
var paramExpr = /\((.*)\);?$/;
|
var paramExpr = /\((.*)\);?$/;
|
||||||
|
|
||||||
function newSection(tok) {
|
function newSection(tok) {
|
||||||
|
@ -122,7 +122,7 @@ function ParagraphParser() {
|
|||||||
|
|
||||||
// Detect separator "lines" within a block. These mark a paragraph break
|
// Detect separator "lines" within a block. These mark a paragraph break
|
||||||
// and are stripped from the output.
|
// and are stripped from the output.
|
||||||
if (/^\s*[=*\-]{5,}\s*$/.test(line)) {
|
if (/^\s*[=*-]{5,}\s*$/.test(line)) {
|
||||||
flushParagraph();
|
flushParagraph();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -286,7 +286,7 @@ function RtfGenerator() {
|
|||||||
|
|
||||||
function rtfEscape(string) {
|
function rtfEscape(string) {
|
||||||
return string
|
return string
|
||||||
.replace(/[\\\{\}]/g, function(m) {
|
.replace(/[\\{}]/g, function(m) {
|
||||||
return '\\' + m;
|
return '\\' + m;
|
||||||
})
|
})
|
||||||
.replace(/\t/g, function() {
|
.replace(/\t/g, function() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user