Passed
Pull Request — master (#66)
by Hayrullah
56s
created

gotil.Map   A

Complexity

Conditions 1

Size

Total Lines 2
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
dl 0
loc 2
rs 10
c 0
b 0
f 0
nop 2
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