github.com/ndau/noms@v1.0.5/go/types/less.go (about)

     1  // Copyright 2016 Attic Labs, Inc. All rights reserved.
     2  // Licensed under the Apache License, version 2.0:
     3  // http://www.apache.org/licenses/LICENSE-2.0
     4  
     5  package types
     6  
     7  import (
     8  	"github.com/ndau/noms/go/hash"
     9  )
    10  
    11  type kindAndHash interface {
    12  	Kind() NomsKind
    13  	Hash() hash.Hash
    14  }
    15  
    16  func valueLess(v1, v2 kindAndHash) bool {
    17  	switch v2.Kind() {
    18  	case BoolKind, NumberKind, StringKind:
    19  		return false
    20  	default:
    21  		return v1.Hash().Less(v2.Hash())
    22  	}
    23  }