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 — benchmark,test: use Object.hasOwn() where applicable · nodejs/node@dcf1ea0

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • benchmark
    • common.js
    • es
      • map-bench.js
  • test/parallel
    • test-http2-capture-rejection.js
    • test-http2-compat-serverrequest-host.js
    • test-process-env.js
    • test-whatwg-url-properties.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎benchmark/common.js‎

Copy file name to clipboardExpand all lines: benchmark/common.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ class Benchmark {
9191
process.exit(1);
9292
}
9393
const [, key, value] = match;
94-
if (Object.prototype.hasOwnProperty.call(configs, key)) {
94+
if (Object.hasOwn(configs, key)) {
9595
if (!cliOptions[key])
9696
cliOptions[key] = [];
9797
cliOptions[key].push(
Collapse file

‎benchmark/es/map-bench.js‎

Copy file name to clipboardExpand all lines: benchmark/es/map-bench.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ function fakeMap() {
7272
get(key) { return m[`$${key}`]; },
7373
set(key, val) { m[`$${key}`] = val; },
7474
get size() { return Object.keys(m).length; },
75-
has(key) { return Object.prototype.hasOwnProperty.call(m, `$${key}`); }
75+
has(key) { return Object.hasOwn(m, `$${key}`); }
7676
};
7777
}
7878

Collapse file

‎test/parallel/test-http2-capture-rejection.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-http2-capture-rejection.js
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,7 @@ events.captureRejections = true;
9090

9191
req.on('response', common.mustCall((headers) => {
9292
assert.strictEqual(headers[':status'], 500);
93-
assert.strictEqual(Object.hasOwnProperty.call(headers, 'content-type'),
94-
false);
93+
assert.strictEqual(Object.hasOwn(headers, 'content-type'), false);
9594
}));
9695

9796
req.on('close', common.mustCall(() => {
Collapse file

‎test/parallel/test-http2-compat-serverrequest-host.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-http2-compat-serverrequest-host.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ server.listen(0, common.mustCall(function() {
3636
assert.strictEqual(rawHeaders[position + 1], value);
3737
}
3838

39-
assert(!Object.hasOwnProperty.call(headers, ':authority'));
40-
assert(!Object.hasOwnProperty.call(rawHeaders, ':authority'));
39+
assert(!Object.hasOwn(headers, ':authority'));
40+
assert(!Object.hasOwn(rawHeaders, ':authority'));
4141

4242
response.on('finish', common.mustCall(function() {
4343
server.close();
Collapse file

‎test/parallel/test-process-env.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-process-env.js
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ if (process.argv[2] === 'you-are-the-child') {
2929
assert.strictEqual('NODE_PROCESS_ENV_DELETED' in process.env, false);
3030
assert.strictEqual(process.env.NODE_PROCESS_ENV, '42');
3131
assert.strictEqual(process.env.hasOwnProperty, 'asdf');
32-
const hasOwnProperty = Object.prototype.hasOwnProperty;
33-
const has = hasOwnProperty.call(process.env, 'hasOwnProperty');
32+
const has = Object.hasOwn(process.env, 'hasOwnProperty');
3433
assert.strictEqual(has, true);
3534
process.exit(0);
3635
}
Collapse file

‎test/parallel/test-whatwg-url-properties.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-whatwg-url-properties.js
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ function testMethod(target, name, methodName = stringifyName(name)) {
6868
assert.strictEqual(typeof value, 'function');
6969
assert.strictEqual(value.name, methodName);
7070
assert.strictEqual(
71-
Object.prototype.hasOwnProperty.call(value, 'prototype'),
71+
Object.hasOwn(value, 'prototype'),
7272
false,
7373
);
7474
}
@@ -83,7 +83,7 @@ function testAccessor(target, name, readonly = false) {
8383
assert.strictEqual(typeof get, 'function');
8484
assert.strictEqual(get.name, `get ${methodName}`);
8585
assert.strictEqual(
86-
Object.prototype.hasOwnProperty.call(get, 'prototype'),
86+
Object.hasOwn(get, 'prototype'),
8787
false,
8888
);
8989

@@ -93,7 +93,7 @@ function testAccessor(target, name, readonly = false) {
9393
assert.strictEqual(typeof set, 'function');
9494
assert.strictEqual(set.name, `set ${methodName}`);
9595
assert.strictEqual(
96-
Object.prototype.hasOwnProperty.call(set, 'prototype'),
96+
Object.hasOwn(set, 'prototype'),
9797
false,
9898
);
9999
}

0 commit comments

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