Files
mostlymatter/vendor/github.com/splitio/go-toolkit/v4/common/sliceutil.go
Joram Wilander aba00a3cfd Update split SDK to 6.0.2 to fix sync bug (#17060)
* Update split SDK to 6.0.2 to fix sync bug

* Vendor and tidy
2021-03-04 11:16:08 -05:00

19 строки
345 B
Go

package common
// Partition create partitions considering the passed amount
func Partition(items []string, maxItems int) [][]string {
var splitted [][]string
for i := 0; i < len(items); i += maxItems {
end := i + maxItems
if end > len(items) {
end = len(items)
}
splitted = append(splitted, items[i:end])
}
return splitted
}