Total Lines | 15 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | package gotil |
||
2 | |||
3 | import ( |
||
4 | "github.com/gotilty/gotil/internal" |
||
5 | ) |
||
6 | |||
7 | // Creates an array of values by running each element in the given array thru iteratee. |
||
8 | // The value to be iterated should be given as the first parameter. |
||
9 | // The second parameter will be a function that will take the parameter and return value type interface{}. |
||
10 | // _ = Each([]int64{10, 20, 30}, func(val interface{}, i int) { |
||
11 | // fmt.Printf("%d apples", val) |
||
12 | // }) |
||
13 | // // Output: 10 apples20 apples30 apples |
||
14 | func Each(a interface{}, f func(val interface{}, i int)) error { |
||
15 | return internal.Each(a, f) |
||
16 | } |
||
17 |