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 2da24ac

Browse filesBrowse files
aduh95richardlau
authored andcommitted
lib: add URI handling functions to primordials
PR-URL: #37394 Backport-PR-URL: #37859 Reviewed-By: Zijian Liu <lxxyxzj@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 93dd799 commit 2da24ac
Copy full SHA for 2da24ac

4 files changed

+13Lines changed: 13 additions & 0 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/internal/per_context/primordials.js‎

Copy file name to clipboardExpand all lines: lib/internal/per_context/primordials.js
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,16 @@ primordials.SafePromise = makeSafe(
106106
class SafePromise extends Promise {}
107107
);
108108

109+
// Create copies of URI handling functions
110+
[
111+
decodeURI,
112+
decodeURIComponent,
113+
encodeURI,
114+
encodeURIComponent,
115+
].forEach((fn) => {
116+
primordials[fn.name] = fn;
117+
});
118+
109119
// Create copies of the namespace objects
110120
[
111121
'JSON',
Collapse file

‎lib/internal/url.js‎

Copy file name to clipboardExpand all lines: lib/internal/url.js
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const {
1414
Symbol,
1515
SymbolIterator,
1616
SymbolToStringTag,
17+
decodeURIComponent,
1718
} = primordials;
1819

1920
const { inspect } = require('internal/util/inspect');
Collapse file

‎lib/querystring.js‎

Copy file name to clipboardExpand all lines: lib/querystring.js
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ const {
2929
MathAbs,
3030
ObjectCreate,
3131
ObjectKeys,
32+
decodeURIComponent,
3233
} = primordials;
3334

3435
const { Buffer } = require('buffer');
Collapse file

‎lib/url.js‎

Copy file name to clipboardExpand all lines: lib/url.js
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const {
2525
ObjectCreate,
2626
ObjectKeys,
2727
SafeSet,
28+
decodeURIComponent,
2829
} = primordials;
2930

3031
const { toASCII } = require('internal/idna');

0 commit comments

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