Skip to content

Commit a793cf4

Browse files
aduh95targos
authored andcommitted
esm: rename URLCanParse to be consistent
PR-URL: #47668 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Jacob Smith <[email protected]> Reviewed-By: Matthew Aitken <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent c0c23fb commit a793cf4

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

lib/internal/modules/esm/hooks.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const {
3434
} = require('internal/errors').codes;
3535
const { exitCodes: { kUnfinishedTopLevelAwait } } = internalBinding('errors');
3636
const { URL } = require('internal/url');
37-
const { canParse: urlCanParse } = internalBinding('url');
37+
const { canParse: URLCanParse } = internalBinding('url');
3838
const { receiveMessageOnPort } = require('worker_threads');
3939
const {
4040
isAnyArrayBuffer,
@@ -274,7 +274,7 @@ class Hooks {
274274
// Avoid expensive URL instantiation for known-good URLs
275275
if (!this.#validatedUrls.has(url)) {
276276
// No need to convert to string, since the type is already validated
277-
if (!urlCanParse(url)) {
277+
if (!URLCanParse(url)) {
278278
throw new ERR_INVALID_RETURN_PROPERTY_VALUE(
279279
'a URL string',
280280
hookErrIdentifier,
@@ -354,7 +354,7 @@ class Hooks {
354354
// Avoid expensive URL instantiation for known-good URLs
355355
if (!this.#validatedUrls.has(nextUrl)) {
356356
// No need to convert to string, since the type is already validated
357-
if (!urlCanParse(nextUrl)) {
357+
if (!URLCanParse(nextUrl)) {
358358
throw new ERR_INVALID_ARG_VALUE(
359359
`${hookErrIdentifier} url`,
360360
nextUrl,

lib/internal/modules/esm/resolve.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const experimentalNetworkImports =
3838
getOptionValue('--experimental-network-imports');
3939
const typeFlag = getOptionValue('--input-type');
4040
const { URL, pathToFileURL, fileURLToPath, isURL, toPathIfFileURL } = require('internal/url');
41-
const { canParse: canParseURL } = internalBinding('url');
41+
const { canParse: URLCanParse } = internalBinding('url');
4242
const {
4343
ERR_INPUT_TYPE_NOT_ALLOWED,
4444
ERR_INVALID_ARG_TYPE,
@@ -328,7 +328,7 @@ function resolvePackageTargetString(
328328
if (internal && !StringPrototypeStartsWith(target, '../') &&
329329
!StringPrototypeStartsWith(target, '/')) {
330330
// No need to convert target to string, since it's already presumed to be
331-
if (!canParseURL(target)) {
331+
if (!URLCanParse(target)) {
332332
const exportTarget = pattern ?
333333
RegExpPrototypeSymbolReplace(patternRegEx, target, () => subpath) :
334334
target + subpath;

0 commit comments

Comments
 (0)