ccc-tnt-psd2ui/npm-packages/mac-v3.4.+/semver/functions/parse.js

17 lines
317 B
JavaScript
Raw Permalink Normal View History

2023-07-24 03:13:08 +00:00
const SemVer = require('../classes/semver')
2023-09-06 01:51:55 +00:00
const parse = (version, options, throwErrors = false) => {
2023-07-24 03:13:08 +00:00
if (version instanceof SemVer) {
return version
}
try {
return new SemVer(version, options)
} catch (er) {
2023-09-06 01:51:55 +00:00
if (!throwErrors) {
return null
}
throw er
2023-07-24 03:13:08 +00:00
}
}
module.exports = parse