MCPcopy
hub / github.com/flosch/pongo2 / Less

Method Less

value.go:525–536  ·  view source on GitHub ↗
(i, j int)

Source from the content-addressed store, hash-verified

523}
524
525func (vl valuesList) Less(i, j int) bool {
526 vi := vl[i]
527 vj := vl[j]
528 switch {
529 case vi.IsInteger() && vj.IsInteger():
530 return vi.Integer() < vj.Integer()
531 case vi.IsFloat() && vj.IsFloat():
532 return vi.Float() < vj.Float()
533 default:
534 return vi.String() < vj.String()
535 }
536}
537
538func (vl valuesList) Swap(i, j int) {
539 vl[i], vl[j] = vl[j], vl[i]

Callers

nothing calls this directly

Calls 5

IsIntegerMethod · 0.80
IntegerMethod · 0.80
IsFloatMethod · 0.80
FloatMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected