25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
317 B

  1. const SemVer = require('../classes/semver')
  2. const parse = (version, options, throwErrors = false) => {
  3. if (version instanceof SemVer) {
  4. return version
  5. }
  6. try {
  7. return new SemVer(version, options)
  8. } catch (er) {
  9. if (!throwErrors) {
  10. return null
  11. }
  12. throw er
  13. }
  14. }
  15. module.exports = parse