★ wanayoo — archive 1999 https://github.com/nodejs/node/commit/b2c243ff8bNouvelle recherche | Portail wanayoo
Skip to content
Permalink
Browse files
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 <anna@addaleax.net>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
  • Loading branch information
vsemozhetbyt authored and rvagg committed Nov 28, 2018
1 parent 35a7646 commit b2c243ff8be562ab6dec3b0d05e783040aa34708
Showing with 1 addition and 3 deletions.
  1. +1 −3 lib/internal/safe_globals.js
@@ -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,

0 comments on commit b2c243f

Please sign in to comment.