github.com/m4gshm/gollections@v0.0.13-0.20240331203319-a34a86e58a24/op/delay/chain/api.go (about)

     1  // Package chain provides functions call chain builder
     2  package chain
     3  
     4  // Of returns a function that calls the specified functions in sequence with the argument returned by the previous one
     5  func Of[T any](funcs ...func(T) T) func(T) T {
     6  	return func(t T) T {
     7  		for _, f := range funcs {
     8  			t = f(t)
     9  		}
    10  		return t
    11  	}
    12  }