function compareVersionLists(v1, v2) {
  const maxLength = Math.max(v1.length, v2.length)
  let p1, p2
  for (let i = 0; i < maxLength; i++) {
    p1 = v1[i] || 0
    p2 = v2[i] || 0
    if (p1 > p2) return 1
    if (p1 < p2) return -1
  }
  return 0
}
function compareVersionLists(v1, v2) {
  const maxLength = Math.max(v1.length, v2.length)
  let p1, p2
  for (let i = 0; i < maxLength; i++) {
    p1 = v1[i] || 0
    p2 = v2[i] || 0
    if (p1 > p2) return 1
    if (p1 < p2) return -1
  }
  return 0
}
function compareVersionLists ( v1 , v2 ) { const maxLength = Math . max ( v1 . length , v2 . length ) let p1 , p2 for ( let i = 0 ; i < maxLength ; i ++ ) { p1 = v1 [ i ] || 0 p2 = v2 [ i ] || 0 if ( p1 > p2 ) return 1 if ( p1 < p2 ) return - 1 } return 0 }
Compare two arrays containing split and transformed to positive/negative numbers parts of version strings, respecting negative/missing values: [1, 2, 1] > [1, 2], but [1, 2, -1] < [1, 2] ([1, 2] is aligned to [1, 2, 0]) Return a negative value if v1 < v2, zero if v1 = v2, a positive value otherwise.
Compare two arrays containing split and transformed to positive / negative numbers parts of version strings respecting negative / missing values : [ 1 2 1 ] > [ 1 2 ] but [ 1 2 - 1 ] < [ 1 2 ] ( [ 1 2 ] is aligned to [ 1 2 0 ] ) Return a negative value if v1 < v2 zero if v1 = v2 a positive value otherwise .
Compare two version lists