Function coerce

Coerces a string if possible

coerce('1.2.3.4') // '1.2.3'
coerce('1.2.3.4', { rtl: true }) // '2.3.4'

build identifier ([+BUILD]) is taken into account

  • Parameters

    • version: undefined | null | string | number

      string to coerce

    • Optionaloptions: CoerceOptions

      options object

    Returns null | string

    version string (including build identifier if it exists) or null if the version string is invalid