From 46a6915e8194dfa0a82a4fedde0d45b880d76492 Mon Sep 17 00:00:00 2001 From: Vse Mozhet Byt Date: Sat, 24 Nov 2018 00:39:32 +0200 Subject: [PATCH] lib: simplify own keys retrieval This replacement can save us a function call, two array spreadings, and an array concatenation. Refs: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/ownKeys#Description --- lib/internal/safe_globals.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/internal/safe_globals.js b/lib/internal/safe_globals.js index ad58fa662b53ef..31de4137f0ad53 100644 --- a/lib/internal/safe_globals.js +++ b/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,