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

@ -391,8 +391,9 @@ function resolvePackageTargetString(
}
if (!StringPrototypeStartsWith(target, './')) {
if (internal && !StringPrototypeStartsWith(target, '../') &&
!StringPrototypeStartsWith(target, '/')) {
if (internal &&
target[0] !== '/' &&
!StringPrototypeStartsWith(target, '../')) {
// No need to convert target to string, since it's already presumed to be
if (!URLCanParse(target)) {
const exportTarget = pattern ?