util: fix built-in detection

This makes sure that the regular expression matches all built-in
objects properly. So far a couple where missed.

Backport-PR-URL: https://github.com/nodejs/node/pull/31431
PR-URL: https://github.com/nodejs/node/pull/30768
Fixes: https://github.com/nodejs/node/issues/30183
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
This commit is contained in:
Ruben Bridgewater authored and Beth Griggs committed 2020-02-06 02:49:38 +00:00
1 parent c6193fe009
commit 0376e1cf4d
1 file changed
+1 -1
+1 -1
View File
@@ -118,7 +118,7 @@ const { NativeModule } = require('internal/bootstrap/loaders');
let hexSlice;
const builtInObjects = new Set(
ObjectGetOwnPropertyNames(global).filter((e) => /^([A-Z][a-z]+)+$/.test(e))
ObjectGetOwnPropertyNames(global).filter((e) => /^[A-Z][a-zA-Z0-9]+$/.test(e))
);
// These options must stay in sync with `getUserOptions`. So if any option will