Function prerelease

Returns an array of prerelease components, or null if none exist.

prerelease('1.2.3-foo.bar+build.123') // ['foo', 'bar']
  • Parameters

    • version: string

      version string

    • OptionaloptionsOrLoose: boolean | Options

      an options object { loose } (where loose is the only available option) or a boolean indicating whether to enable loose mode. In loose mode, the parser is more forgiving with imperfectly formatted semver strings

    Returns null | readonly (string | number)[]

    an array of prerelease components, or null if none exist