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

Method Less

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

Source from the content-addressed store, hash-verified

500}
501
502func (sk sortedKeys) Less(i, j int) bool {
503 vi := &Value{val: sk[i]}
504 vj := &Value{val: sk[j]}
505 switch {
506 case vi.IsInteger() && vj.IsInteger():
507 return vi.Integer() < vj.Integer()
508 case vi.IsFloat() && vj.IsFloat():
509 return vi.Float() < vj.Float()
510 default:
511 return vi.String() < vj.String()
512 }
513}
514
515func (sk sortedKeys) Swap(i, j int) {
516 sk[i], sk[j] = sk[j], sk[i]

Callers

nothing calls this directly

Calls 5

IsIntegerMethod · 0.95
IntegerMethod · 0.95
IsFloatMethod · 0.95
FloatMethod · 0.95
StringMethod · 0.95

Tested by

no test coverage detected