Skip to content

Commit 1a9a63c

Browse files
trivikrmerceyz
authored andcommitted
chore(file): use const for path in getCandidates (#4281)
* chore(file): use const for path in getCandidates * chore: yarn version check --interactive (cherry picked from commit df41c95)
1 parent 4f847fc commit 1a9a63c

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

.yarn/versions/f6c9fb9e.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
releases:
2+
"@yarnpkg/plugin-file": patch
3+
4+
declined:
5+
- "@yarnpkg/cli"

packages/plugin-file/sources/TarballFileResolver.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,9 @@ export class TarballFileResolver implements Resolver {
4848
}
4949

5050
async getCandidates(descriptor: Descriptor, dependencies: unknown, opts: ResolveOptions) {
51-
let path = descriptor.range;
52-
53-
if (path.startsWith(PROTOCOL))
54-
path = path.slice(PROTOCOL.length);
51+
const path = descriptor.range.startsWith(PROTOCOL)
52+
? descriptor.range.slice(PROTOCOL.length)
53+
: descriptor.range;
5554

5655
return [structUtils.makeLocator(descriptor, `${PROTOCOL}${npath.toPortablePath(path)}`)];
5756
}

0 commit comments

Comments
 (0)