From 6fc6bec6caf5338763896f1ba5cc4483ee95b4b6 Mon Sep 17 00:00:00 2001 From: Ertugrul Kutluer Date: Wed, 13 Apr 2022 19:17:59 +0300 Subject: [PATCH] fix: minor --- docs/collection.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/docs/collection.md b/docs/collection.md index 34147a1..27bc841 100644 --- a/docs/collection.md +++ b/docs/collection.md @@ -1,3 +1,31 @@ +## Every + +Checks if the predicate returns true for all of the collection's elements. When the predicate returns false, the iteration comes to an end. + +> ***array, slice, map & struct are supported*** + +```go +gotil.Every(val, f) +``` + +### examples + +>💻 [Try on Playground](https://go.dev/play/p/WifLSEZaMSS) + +```go +m1 := []int{123, 6787} + +gotil.Each(m1, func(v interface{}, k interface{}) { + fmt.Println(k, v) +}) +``` + +```go +//output: +0 123 +1 6787 +``` + ## Each Iterates an array of values by running each element in the given array thru iteratee.