Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a673d44

Browse filesBrowse files
princejwesleyaddaleax
authored andcommitted
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: #9591 Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
1 parent 77e145a commit a673d44
Copy full SHA for a673d44

File tree

Expand file treeCollapse file tree

4 files changed

+9
-9
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

4 files changed

+9
-9
lines changed
Open diff view settings
Collapse file

‎lib/url.js‎

Copy file name to clipboardExpand all lines: lib/url.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const protocolPattern = /^([a-z0-9.+-]+:)/i;
4444
const portPattern = /:[0-9]*$/;
4545

4646
// Special case for a simple path URL
47-
const simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/;
47+
const simplePathPattern = /^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/;
4848

4949
const hostnameMaxLen = 255;
5050
// protocols that can allow "unsafe" and "unwise" chars.
Collapse file

‎tools/doc/html.js‎

Copy file name to clipboardExpand all lines: tools/doc/html.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ function loadGtoc(cb) {
9090
function toID(filename) {
9191
return filename
9292
.replace('.html', '')
93-
.replace(/[^\w\-]/g, '-')
93+
.replace(/[^\w-]/g, '-')
9494
.replace(/-+/g, '-');
9595
}
9696

@@ -284,7 +284,7 @@ function linkJsTypeDocs(text) {
284284
// Handle types, for example the source Markdown might say
285285
// "This argument should be a {Number} or {String}"
286286
for (i = 0; i < parts.length; i += 2) {
287-
typeMatches = parts[i].match(/\{([^\}]+)\}/g);
287+
typeMatches = parts[i].match(/\{([^}]+)\}/g);
288288
if (typeMatches) {
289289
typeMatches.forEach(function(typeMatch) {
290290
parts[i] = parts[i].replace(typeMatch, typeParser.toLink(typeMatch));
Collapse file

‎tools/doc/json.js‎

Copy file name to clipboardExpand all lines: tools/doc/json.js
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function doJSON(input, filename, cb) {
3131
// <!-- type = module -->
3232
// This is for cases where the markdown semantic structure is lacking.
3333
if (type === 'paragraph' || type === 'html') {
34-
var metaExpr = /<!--([^=]+)=([^\-]+)-->\n*/g;
34+
var metaExpr = /<!--([^=]+)=([^-]+)-->\n*/g;
3535
text = text.replace(metaExpr, function(_0, k, v) {
3636
current[k.trim()] = v.trim();
3737
return '';
@@ -371,7 +371,7 @@ function parseListItem(item) {
371371
item.name = 'return';
372372
text = text.replace(retExpr, '');
373373
} else {
374-
var nameExpr = /^['`"]?([^'`": \{]+)['`"]?\s*:?\s*/;
374+
var nameExpr = /^['`"]?([^'`": {]+)['`"]?\s*:?\s*/;
375375
var name = text.match(nameExpr);
376376
if (name) {
377377
item.name = name[1];
@@ -388,7 +388,7 @@ function parseListItem(item) {
388388
}
389389

390390
text = text.trim();
391-
var typeExpr = /^\{([^\}]+)\}/;
391+
var typeExpr = /^\{([^}]+)\}/;
392392
var type = text.match(typeExpr);
393393
if (type) {
394394
item.type = type[1];
@@ -551,7 +551,7 @@ var classMethExpr =
551551
/^class\s*method\s*:?[^.]+\.([^ .()]+)\([^)]*\)\s*?$/i;
552552
var methExpr =
553553
/^(?:method:?\s*)?(?:[^.]+\.)?([^ .()]+)\([^)]*\)\s*?$/i;
554-
var newExpr = /^new ([A-Z][a-zA-Z]+)\([^\)]*\)\s*?$/;
554+
var newExpr = /^new ([A-Z][a-zA-Z]+)\([^)]*\)\s*?$/;
555555
var paramExpr = /\((.*)\);?$/;
556556

557557
function newSection(tok) {
Collapse file

‎tools/license2rtf.js‎

Copy file name to clipboardExpand all lines: tools/license2rtf.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ function ParagraphParser() {
122122

123123
// Detect separator "lines" within a block. These mark a paragraph break
124124
// and are stripped from the output.
125-
if (/^\s*[=*\-]{5,}\s*$/.test(line)) {
125+
if (/^\s*[=*-]{5,}\s*$/.test(line)) {
126126
flushParagraph();
127127
return;
128128
}
@@ -286,7 +286,7 @@ function RtfGenerator() {
286286

287287
function rtfEscape(string) {
288288
return string
289-
.replace(/[\\\{\}]/g, function(m) {
289+
.replace(/[\\{}]/g, function(m) {
290290
return '\\' + m;
291291
})
292292
.replace(/\t/g, function() {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.