diff options
author | Vse Mozhet Byt <vsemozhetbyt@gmail.com> | 2018-11-24 00:39:32 +0200 |
---|---|---|
committer | Vse Mozhet Byt <vsemozhetbyt@gmail.com> | 2018-11-26 01:31:49 +0200 |
commit | f2432a47616979780e7ca76a935e5f05c4ee31b5 (patch) | |
tree | 4babdd8395edf0d01a4d5637968d808232ed8e88 /lib | |
parent | 14707b681da02ef290a986f7613797a3c7ec1ad5 (diff) | |
download | android-node-v8-f2432a47616979780e7ca76a935e5f05c4ee31b5.tar.gz android-node-v8-f2432a47616979780e7ca76a935e5f05c4ee31b5.tar.bz2 android-node-v8-f2432a47616979780e7ca76a935e5f05c4ee31b5.zip |
lib: simplify own keys retrieval
This replacement can save us a function call, two array spreadings,
and an array concatenation.
PR-URL: https://github.com/nodejs/node/pull/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>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/internal/safe_globals.js | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/lib/internal/safe_globals.js b/lib/internal/safe_globals.js index ad58fa662b..31de4137f0 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, |