util: fix built-in detection

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

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 2019-11-30 13:33:18 +01:00
parent 654d22ccf4
commit 28ee032fca
No known key found for this signature in database
GPG Key ID: F07496B3EB3C1762
1 changed files with 1 additions and 1 deletions

View File

@ -116,7 +116,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