mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
lib: use remaining typed arrays from primordials
PR-URL: https://github.com/nodejs/node/pull/35499 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Ujjwal Sharma <ryzokuken@disroot.org> Reviewed-By: Shingo Inoue <leko.noor@gmail.com>
This commit is contained in:
committed by
Node.js GitHub Bot
parent
070873649c
commit
1469984645
@@ -11,6 +11,8 @@ rules:
|
||||
- error
|
||||
- name: Array
|
||||
message: "Use `const { Array } = primordials;` instead of the global."
|
||||
- name: ArrayBuffer
|
||||
message: "Use `const { ArrayBuffer } = primordials;` instead of the global."
|
||||
- name: BigInt
|
||||
message: "Use `const { BigInt } = primordials;` instead of the global."
|
||||
- name: BigInt64Array
|
||||
@@ -67,6 +69,12 @@ rules:
|
||||
message: "Use `const { URIError } = primordials;` instead of the global."
|
||||
- name: Uint16Array
|
||||
message: "Use `const { Uint16Array } = primordials;` instead of the global."
|
||||
- name: Uint32Array
|
||||
message: "Use `const { Uint32Array } = primordials;` instead of the global."
|
||||
- name: Uint8Array
|
||||
message: "Use `const { Uint8Array } = primordials;` instead of the global."
|
||||
- name: Uint8ClampedArray
|
||||
message: "Use `const { Uint8ClampedArray } = primordials;` instead of the global."
|
||||
- name: WeakMap
|
||||
message: "Use `const { WeakMap } = primordials;` instead of the global."
|
||||
- name: WeakSet
|
||||
|
||||
@@ -39,6 +39,7 @@ const {
|
||||
ObjectSetPrototypeOf,
|
||||
SymbolSpecies,
|
||||
SymbolToPrimitive,
|
||||
Uint8Array,
|
||||
Uint8ArrayPrototype,
|
||||
} = primordials;
|
||||
|
||||
@@ -387,7 +388,7 @@ function SlowBuffer(length) {
|
||||
return createUnsafeBuffer(length);
|
||||
}
|
||||
|
||||
ObjectSetPrototypeOf(SlowBuffer.prototype, Uint8Array.prototype);
|
||||
ObjectSetPrototypeOf(SlowBuffer.prototype, Uint8ArrayPrototype);
|
||||
ObjectSetPrototypeOf(SlowBuffer, Uint8Array);
|
||||
|
||||
function allocate(size) {
|
||||
|
||||
@@ -6,6 +6,7 @@ const {
|
||||
Float64Array,
|
||||
MathFloor,
|
||||
Number,
|
||||
Uint8Array,
|
||||
} = primordials;
|
||||
|
||||
const {
|
||||
|
||||
@@ -5,6 +5,7 @@ const {
|
||||
ObjectDefineProperty,
|
||||
ObjectSetPrototypeOf,
|
||||
Symbol,
|
||||
Uint8Array,
|
||||
} = primordials;
|
||||
|
||||
const {
|
||||
|
||||
@@ -10,6 +10,8 @@ const {
|
||||
ObjectGetOwnPropertyDescriptors,
|
||||
Symbol,
|
||||
SymbolToStringTag,
|
||||
Uint32Array,
|
||||
Uint8Array,
|
||||
} = primordials;
|
||||
|
||||
const {
|
||||
|
||||
@@ -16,6 +16,8 @@ const {
|
||||
ReflectGetPrototypeOf,
|
||||
Set,
|
||||
Symbol,
|
||||
Uint32Array,
|
||||
Uint8Array,
|
||||
} = primordials;
|
||||
|
||||
const {
|
||||
|
||||
@@ -18,6 +18,7 @@ const {
|
||||
SetPrototype,
|
||||
SetPrototypeHas,
|
||||
StringPrototypeReplace,
|
||||
Uint32Array,
|
||||
} = primordials;
|
||||
|
||||
const {
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
const {
|
||||
SymbolIterator,
|
||||
Uint8Array,
|
||||
} = primordials;
|
||||
|
||||
const { Buffer } = require('buffer');
|
||||
|
||||
@@ -20,6 +20,7 @@ const {
|
||||
StringPrototypeValueOf,
|
||||
SymbolPrototypeValueOf,
|
||||
SymbolToStringTag,
|
||||
Uint8Array,
|
||||
} = primordials;
|
||||
|
||||
const { compare } = internalBinding('buffer');
|
||||
|
||||
@@ -58,6 +58,10 @@ const {
|
||||
SymbolIterator,
|
||||
SymbolToStringTag,
|
||||
Uint16Array,
|
||||
Uint32Array,
|
||||
Uint8Array,
|
||||
Uint8ArrayPrototype,
|
||||
Uint8ClampedArray,
|
||||
uncurryThis,
|
||||
} = primordials;
|
||||
|
||||
@@ -138,7 +142,7 @@ const mapSizeGetter = uncurryThis(
|
||||
ObjectGetOwnPropertyDescriptor(MapPrototype, 'size').get);
|
||||
const typedArraySizeGetter = uncurryThis(
|
||||
ObjectGetOwnPropertyDescriptor(
|
||||
ObjectGetPrototypeOf(Uint8Array.prototype), 'length').get);
|
||||
ObjectGetPrototypeOf(Uint8ArrayPrototype), 'length').get);
|
||||
|
||||
let hexSlice;
|
||||
|
||||
|
||||
@@ -5,10 +5,11 @@ const {
|
||||
ObjectGetOwnPropertyDescriptor,
|
||||
ObjectGetPrototypeOf,
|
||||
SymbolToStringTag,
|
||||
Uint8ArrayPrototype,
|
||||
uncurryThis,
|
||||
} = primordials;
|
||||
|
||||
const TypedArrayPrototype = ObjectGetPrototypeOf(Uint8Array.prototype);
|
||||
const TypedArrayPrototype = ObjectGetPrototypeOf(Uint8ArrayPrototype);
|
||||
|
||||
const TypedArrayProto_toStringTag =
|
||||
uncurryThis(
|
||||
|
||||
@@ -14,6 +14,7 @@ const {
|
||||
String,
|
||||
Symbol,
|
||||
SymbolFor,
|
||||
Uint32Array,
|
||||
} = primordials;
|
||||
|
||||
const EventEmitter = require('events');
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
'use strict';
|
||||
|
||||
const {
|
||||
ArrayBuffer,
|
||||
Error,
|
||||
MathMax,
|
||||
NumberIsFinite,
|
||||
@@ -33,6 +34,7 @@ const {
|
||||
ObjectKeys,
|
||||
ObjectSetPrototypeOf,
|
||||
Symbol,
|
||||
Uint32Array,
|
||||
} = primordials;
|
||||
|
||||
const {
|
||||
|
||||
Reference in New Issue
Block a user