Skip to content

Commit b27081f

Browse files
committed
trim pkg.parse input
1 parent fb759d6 commit b27081f

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/utils/pkg.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import * as semver from "./semver.ts"
33

44
/// allows inputs `nodejs.org@16` when `semver.parse` would reject
55
export function parse(input: string): PackageRequirement {
6+
input = input.trim()
7+
68
const match = input.match(/^(.+?)([\^=~<>@].+)?$/)
79
if (!match) throw new Error(`invalid pkgspec: ${input}`)
810
if (!match[2]) match[2] = "*"

0 commit comments

Comments
 (0)