Skip to content

Commit

Permalink
lib: simplify own keys retrieval
Browse files Browse the repository at this point in the history
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 <anna@addaleax.net>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
  • Loading branch information
vsemozhetbyt authored and targos committed Nov 27, 2018
1 parent 838eecc commit b99e355
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions lib/internal/safe_globals.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
'use strict';

const copyProps = (unsafe, safe) => {
for (const key of [...Object.getOwnPropertyNames(unsafe),
...Object.getOwnPropertySymbols(unsafe)
]) {
for (const key of Reflect.ownKeys(unsafe)) {
if (!Object.getOwnPropertyDescriptor(safe, key)) {
Object.defineProperty(
safe,
Expand Down

0 comments on commit b99e355

Please sign in to comment.