GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — util: remove unreachable defensive coding · nodejs/node@bff201a

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib/internal/util
    • comparisons.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/internal/util/comparisons.js‎

Copy file name to clipboardExpand all lines: lib/internal/util/comparisons.js
+3-42Lines changed: 3 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,6 @@ const {
4444
isSymbolObject,
4545
isFloat32Array,
4646
isFloat64Array,
47-
isUint8Array,
48-
isUint8ClampedArray,
49-
isUint16Array,
50-
isUint32Array,
51-
isInt8Array,
52-
isInt16Array,
53-
isInt32Array,
54-
isBigInt64Array,
55-
isBigUint64Array
5647
} = types;
5748
const {
5849
getOwnNonIndexProperties,
@@ -126,38 +117,6 @@ function isEqualBoxedPrimitive(val1, val2) {
126117
assert.fail(`Unknown boxed type ${val1}`);
127118
}
128119

129-
function isIdenticalTypedArrayType(a, b) {
130-
// Fast path to reduce type checks in the common case.
131-
const check = types[`is${TypedArrayPrototypeGetSymbolToStringTag(a)}`];
132-
if (check !== undefined && check(a)) {
133-
return check(b);
134-
}
135-
// Manipulated Symbol.toStringTag.
136-
for (const check of [
137-
isUint16Array,
138-
isUint32Array,
139-
isInt8Array,
140-
isInt16Array,
141-
isInt32Array,
142-
isFloat32Array,
143-
isFloat64Array,
144-
isBigInt64Array,
145-
isBigUint64Array,
146-
isUint8ClampedArray,
147-
isUint8Array
148-
]) {
149-
if (check(a)) {
150-
return check(b);
151-
}
152-
}
153-
/* c8 ignore next 4 */
154-
assert.fail(
155-
'Unknown TypedArray type checking ' +
156-
`${TypedArrayPrototypeGetSymbolToStringTag(a)} ${a}\n` +
157-
`and ${TypedArrayPrototypeGetSymbolToStringTag(b)} ${b}`
158-
);
159-
}
160-
161120
// Notes: Type tags are historical [[Class]] properties that can be set by
162121
// FunctionTemplate::SetClassName() in C++ or Symbol.toStringTag in JS
163122
// and retrieved using Object.prototype.toString.call(obj) in JS
@@ -241,8 +200,10 @@ function innerDeepEqual(val1, val2, strict, memos) {
241200
return false;
242201
}
243202
} else if (isArrayBufferView(val1)) {
244-
if (!isIdenticalTypedArrayType(val1, val2))
203+
if (TypedArrayPrototypeGetSymbolToStringTag(val1) !==
204+
TypedArrayPrototypeGetSymbolToStringTag(val2)) {
245205
return false;
206+
}
246207
if (!strict && (isFloat32Array(val1) || isFloat64Array(val1))) {
247208
if (!areSimilarFloatArrays(val1, val2)) {
248209
return false;

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.