lib: remove startsWith/endsWith primordials for char checks

PR-URL: https://github.com/nodejs/node/pull/55407
Reviewed-By: Jacob Smith <jacob@frende.me>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Mattias Buelens <mattias@buelens.com>
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev>
This commit is contained in:
Gürgün Dayıoğlu 2024-10-19 12:18:10 +02:00 committed by Ruy Adorno
parent 6e3e99c81e
commit 753cbede2a
No known key found for this signature in database
11 changed files with 17 additions and 22 deletions

View file

@ -202,7 +202,7 @@ function addBuiltinLibsToObject(object, dummyModuleName) {
ArrayPrototypeForEach(builtinModules, (name) => {
// Neither add underscored modules, nor ones that contain slashes (e.g.,
// 'fs/promises') or ones that are already defined.
if (StringPrototypeStartsWith(name, '_') ||
if (name[0] === '_' ||
StringPrototypeIncludes(name, '/') ||
ObjectPrototypeHasOwnProperty(object, name)) {
return;