From 5addba2abc2e384e751e8884b4ac3219688c2473 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Sun, 4 Jul 2021 00:17:52 +0200 Subject: refactor: use primordials in runtime/, part2 (#11248) --- runtime/js/40_compiler_api.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'runtime/js/40_compiler_api.js') diff --git a/runtime/js/40_compiler_api.js b/runtime/js/40_compiler_api.js index 75c21b8dd..4d5cda398 100644 --- a/runtime/js/40_compiler_api.js +++ b/runtime/js/40_compiler_api.js @@ -8,6 +8,11 @@ ((window) => { const core = window.Deno.core; const util = window.__bootstrap.util; + const { + StringPrototypeMatch, + PromiseReject, + TypeError, + } = window.__bootstrap.primordials; /** * @typedef {object} ImportMap @@ -47,7 +52,10 @@ * @returns {string} */ function checkRelative(specifier) { - return specifier.match(/^([\.\/\\]|https?:\/{2}|file:\/{2})/) + return StringPrototypeMatch( + specifier, + /^([\.\/\\]|https?:\/{2}|file:\/{2})/, + ) ? specifier : `./${specifier}`; } @@ -70,7 +78,7 @@ function emit(rootSpecifier, options = {}) { util.log(`Deno.emit`, { rootSpecifier }); if (!rootSpecifier) { - return Promise.reject( + return PromiseReject( new TypeError("A root specifier must be supplied."), ); } -- cgit v1.2.3