/**
* @function map
* @description Maps over an array and applies a function
* @param {Function} cb
* @param {Iterable} a
* @return {Iterable}
* @since v1.0.2
* @example
*
* const result = map(identity, [0,2,3])
* // result = [0,2,3]
* const add2 = add(2)
* const result = map(add2, [0,2,3])
* // result = [2,4,5]
**/
import curry from '../curry'
export default curry(function map (cb, a) {
let i = -1
const l = a.length
const r = new Array(l)
while (++i < l) {
r[i] = cb(a[i], i, a)
}
return r
})