From 6728ad4203d731e555dabf89ec6157f113454ce6 Mon Sep 17 00:00:00 2001 From: Kenta Moriuchi Date: Mon, 1 May 2023 22:30:02 +0900 Subject: fix(core): Use primordials for methods (#18839) I would like to get this change into Deno before merging https://github.com/denoland/deno_lint/pull/1152 --- ext/crypto/00_crypto.js | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'ext/crypto') diff --git a/ext/crypto/00_crypto.js b/ext/crypto/00_crypto.js index 2208124f6..5be2e0c1c 100644 --- a/ext/crypto/00_crypto.js +++ b/ext/crypto/00_crypto.js @@ -12,11 +12,12 @@ const primordials = globalThis.__bootstrap.primordials; import * as webidl from "ext:deno_webidl/00_webidl.js"; import DOMException from "ext:deno_web/01_dom_exception.js"; const { + ArrayBufferIsView, ArrayBufferPrototype, - ArrayBufferPrototypeSlice, ArrayBufferPrototypeGetByteLength, - ArrayBufferIsView, + ArrayBufferPrototypeSlice, ArrayPrototypeEvery, + ArrayPrototypeFilter, ArrayPrototypeFind, ArrayPrototypeIncludes, DataViewPrototypeGetBuffer, @@ -28,21 +29,21 @@ const { ObjectAssign, ObjectPrototypeHasOwnProperty, ObjectPrototypeIsPrototypeOf, - StringPrototypeToLowerCase, - StringPrototypeToUpperCase, - StringPrototypeCharCodeAt, - StringFromCharCode, SafeArrayIterator, SafeWeakMap, + StringFromCharCode, + StringPrototypeCharCodeAt, + StringPrototypeToLowerCase, + StringPrototypeToUpperCase, Symbol, SymbolFor, SyntaxError, - TypedArrayPrototypeSlice, + TypeError, TypedArrayPrototypeGetBuffer, TypedArrayPrototypeGetByteLength, TypedArrayPrototypeGetByteOffset, TypedArrayPrototypeGetSymbolToStringTag, - TypeError, + TypedArrayPrototypeSlice, Uint8Array, WeakMapPrototypeGet, WeakMapPrototypeSet, @@ -388,7 +389,10 @@ function constructKey(type, extractable, usages, algorithm, handle) { * @returns */ function usageIntersection(a, b) { - return a.filter((i) => b.includes(i)); + return ArrayPrototypeFilter( + a, + (i) => ArrayPrototypeIncludes(b, i), + ); } // TODO(lucacasonato): this should be moved to rust -- cgit v1.2.3