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,assert: fix boxed primitives bug · nodejs/node@f1c22ea

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib/internal/util
    • comparisons.js
  • test/parallel
    • test-assert-deep.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
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@ function strictDeepEqual(val1, val2, memos) {
120120
const val1Value = val1.valueOf();
121121
// Note: Boxed string keys are going to be compared again by Object.keys
122122
if (val1Value !== val1) {
123+
if (typeof val2.valueOf !== 'function') {
124+
return false;
125+
}
123126
if (!innerDeepEqual(val1Value, val2.valueOf(), true))
124127
return false;
125128
// Fast path for boxed primitives
Collapse file

‎test/parallel/test-assert-deep.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-assert-deep.js
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -931,3 +931,10 @@ assert.throws(() => assert.deepStrictEqual(new Boolean(true), {}),
931931
);
932932
util.inspect.defaultOptions = tmp;
933933
}
934+
935+
// Basic valueOf check.
936+
{
937+
const a = new String(1);
938+
a.valueOf = undefined;
939+
assertNotDeepOrStrict(a, new String(1));
940+
}

0 commit comments

Comments
0 (0)
You are visitor 01402775 — 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.