Codebase list golang-github-vbauerster-mpb / c0a9ceb
refactoring: sortDecorators to populateEwmaDecorators Vladimir Bauer 1 year, 10 months ago
2 changed file(s) with 4 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
561561 return table
562562 }
563563
564 func (s *bState) sortDecorators(decorators []decor.Decorator) {
564 func (s *bState) populateEwmaDecorators(decorators []decor.Decorator) {
565565 for _, d := range decorators {
566 d := unwrap(d)
567 if d, ok := d.(decor.EwmaDecorator); ok {
566 if d, ok := unwrap(d).(decor.EwmaDecorator); ok {
568567 s.ewmaDecorators = append(s.ewmaDecorators, d)
569568 }
570569 }
2323 func PrependDecorators(decorators ...decor.Decorator) BarOption {
2424 decorators = inspect(decorators)
2525 return func(s *bState) {
26 s.sortDecorators(decorators)
26 s.populateEwmaDecorators(decorators)
2727 s.decorators[0] = decorators
2828 }
2929 }
3232 func AppendDecorators(decorators ...decor.Decorator) BarOption {
3333 decorators = inspect(decorators)
3434 return func(s *bState) {
35 s.sortDecorators(decorators)
35 s.populateEwmaDecorators(decorators)
3636 s.decorators[1] = decorators
3737 }
3838 }