Skip to content

Commit 14325dd

Browse files
committed
revert semver.inc
1 parent cbca3e5 commit 14325dd

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

classes/semver.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const debug = require('../internal/debug')
22
const { MAX_LENGTH, MAX_SAFE_INTEGER } = require('../internal/constants')
3-
const { safeRe: re, safeSrc: src, t } = require('../internal/re')
3+
const { safeRe: re, t } = require('../internal/re')
44

55
const parseOptions = require('../internal/parse-options')
66
const { compareIdentifiers } = require('../internal/identifiers')
@@ -182,8 +182,7 @@ class SemVer {
182182
}
183183
// Avoid an invalid semver results
184184
if (identifier) {
185-
const r = new RegExp(`^${this.options.loose ? src[t.PRERELEASELOOSE] : src[t.PRERELEASE]}$`)
186-
const match = `-${identifier}`.match(r)
185+
const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE])
187186
if (!match || match[1] !== identifier) {
188187
throw new Error(`invalid identifier: ${identifier}`)
189188
}

0 commit comments

Comments
 (0)