Skip to content

Commit 021b174

Browse files
JakobJingleheimeraduh95
authored andcommitted
module: tidy code string concat → string templates
PR-URL: #55820 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
1 parent 6ffb66f commit 021b174

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

‎lib/internal/modules/package_json_reader.js‎

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,7 @@ function parsePackageName(specifier, base) {
219219
}
220220

221221
functiongetPackageJSONURL(specifier,base){
222-
const{ packageName, packageSubpath, isScoped }=
223-
parsePackageName(specifier,base);
222+
const{ packageName, packageSubpath, isScoped }=parsePackageName(specifier,base);
224223

225224
// ResolveSelf
226225
constpackageConfig=getPackageScopeConfig(base);
@@ -231,8 +230,7 @@ function getPackageJSONURL(specifier, base) {
231230
}
232231
}
233232

234-
letpackageJSONUrl=
235-
newURL('./node_modules/'+packageName+'/package.json',base);
233+
letpackageJSONUrl=newURL(`./node_modules/${packageName}/package.json`,base);
236234
letpackageJSONPath=fileURLToPath(packageJSONUrl);
237235
letlastPath;
238236
do{
@@ -243,9 +241,10 @@ function getPackageJSONURL(specifier, base) {
243241
// Check for !stat.isDirectory()
244242
if(stat!==1){
245243
lastPath=packageJSONPath;
246-
packageJSONUrl=newURL((isScoped ?
247-
'../../../../node_modules/' : '../../../node_modules/')+
248-
packageName+'/package.json',packageJSONUrl);
244+
packageJSONUrl=newURL(
245+
`${isScoped ? '../' : ''}../../../node_modules/${packageName}/package.json`,
246+
packageJSONUrl,
247+
);
249248
packageJSONPath=fileURLToPath(packageJSONUrl);
250249
continue;
251250
}

0 commit comments

Comments
 (0)