| Total Lines | 16 |
| 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 | // // Example: |
||
| 11 | // func square(a interface{}, i int()) interface{} { |
||
| 12 | // b, _ := ToInt64(a) |
||
| 13 | // return (b * b) |
||
| 14 | // } |
||
| 15 | func Map(a interface{}, f func(val interface{}, i int) interface{}) (interface{}, error) { |
||
| 16 | return internal.Map(a, f) |
||
| 17 | } |
||
| 18 |