Skip to content

Commit

Permalink
RevChain
Browse files Browse the repository at this point in the history
  • Loading branch information
sdfsdhgjkbmnmxc committed Mar 23, 2021
1 parent d6908a3 commit 8c9199a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions swap.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ package swap
import "time"

func Chain(fns ...func()) func() {
return func() {
for i := range fns {
fns[i]()
}
}
}

func RevChain(fns ...func()) func() {
return func() {
for i := len(fns) - 1; i >= 0; i-- {
fns[i]()
Expand Down

0 comments on commit 8c9199a

Please sign in to comment.