Skip to content

Commit b2c243f

Browse files
vsemozhetbytrvagg
authored andcommitted
lib: simplify own keys retrieval
This replacement can save us a function call, two array spreadings, and an array concatenation. PR-URL: #24582 Refs: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/ownKeys#Description Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Gus Caplan <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
1 parent 35a7646 commit b2c243f

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

lib/internal/safe_globals.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
'use strict';
22

33
const copyProps = (unsafe, safe) => {
4-
for (const key of [...Object.getOwnPropertyNames(unsafe),
5-
...Object.getOwnPropertySymbols(unsafe)
6-
]) {
4+
for (const key of Reflect.ownKeys(unsafe)) {
75
if (!Object.getOwnPropertyDescriptor(safe, key)) {
86
Object.defineProperty(
97
safe,

0 commit comments

Comments
 (0)