hunk.code_window:         "jest": "27.4.7",
           "jest-canvas-mock": "2.3.1",
           "jest-junit": "13.0.0",
           "react-beautiful-dnd": "13.1.0",
           "react-bootstrap": "1.6.1",
           "react-refresh": "0.11.0",
           "react-test-renderer": "17.0.2",
           "redux-mock-store": "1.5.4",
           "redux-thunk": "2.4.1",
           "style-loader": "3.3.1",
           "ts-prune": "0.10.3"
  
hunk.labels: keep keep keep keep keep replace keep keep keep keep keep
hunk.file_path: webapp/package-lock.json
hunk.type: replace
file: // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
  // See LICENSE.txt for license information.
  
  package version
  
  import (
  	"regexp"
  	"strconv"
  	"strings"
  )
  
  type V string
  
  func (v V) GreaterThanOrEqualTo(other V) bool {
  	return !v.LessThan(other)
  }
  
  func (v V) LessThan(other V) bool {
  	leftParts, leftCount := split(v)
  	rightParts, rightCount := split(other)
  
  	var length int
  	if leftCount < rightCount {
  		length = rightCount
  	} else {
  		length = leftCount
  	}
  
  	for i := 0; i < length; i++ {
  		var left, right string
  
  		if i < leftCount {
  			left = leftParts[i]
  		}
  
  		if i < rightCount {
  			right = rightParts[i]
  		}
  
  		if left == right {
  			continue
  		}
  
  		leftInt := parseInt(left)
  		rightInt := parseInt(right)
  
  		isNumericalComparison := leftInt != nil && rightInt != nil
  
  		if isNumericalComparison {
  			return *leftInt < *rightInt
  		}
  
  		return left < right
  	}
  
  	return false
  }
  
  func split(v V) ([]string, int) {
  	var chunks []string
  
  	for _, part := range strings.Split(string(v), ".") {
  		chunks = append(chunks, splitNumericalChunks(part)...)
  	}
  
  	return chunks, len(chunks)
  }
  
  var numericalOrAlphaRE = regexp.MustCompile(`(\d+|\D+)`)
  
  func splitNumericalChunks(s string) []string {
  	return numericalOrAlphaRE.FindAllString(s, -1)
  }
  
  func parseInt(s string) *int64 {
  	if n, err := strconv.ParseInt(s, 10, 64); err == nil {
  		return &n
  	}
  	return nil
  }
  