buffer: remove unnecessary lazy loading

PR-URL: https://github.com/nodejs/node/pull/45807
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
This commit is contained in:
Antoine du Hamel authored and Michaël Zasso committed 2022-12-13 09:42:46 +00:00
1 parent 349b4f8817
commit 49840d443c
1 file changed
+2 -7
+2 -7
View File
@@ -30,6 +30,7 @@ const {
TextDecoder,
TextEncoder,
} = require('internal/encoding');
const { URL } = require('internal/url');
const {
makeTransferable,
@@ -77,7 +78,6 @@ const kMaxChunkSize = 65536;
const disallowedTypeCharacters = /[^\u{0020}-\u{007E}]/u;
let ReadableStream;
let URL;
const enc = new TextEncoder();
let dec;
@@ -86,11 +86,6 @@ let dec;
// references between the url, internal/blob, and buffer
// modules, lazy loading here makes sure that things work.
function lazyURL(id) {
URL ??= require('internal/url').URL;
return new URL(id);
}
function lazyReadableStream(options) {
// eslint-disable-next-line no-global-assign
ReadableStream ??=
@@ -378,7 +373,7 @@ ObjectDefineProperties(Blob.prototype, {
function resolveObjectURL(url) {
url = `${url}`;
try {
const parsed = new lazyURL(url);
const parsed = new URL(url);
const split = StringPrototypeSplit(parsed.pathname, ':');