in packages/shared/src/array.ts [82:107]
export function map<TItem, TResult>(
val: TItem[],
iterator: MapArrayIterator<TItem, TResult>,
revert?: boolean
): any
export function map<T extends {}, TResult>(
val: T,
iterator: MapObjectIterator<T[keyof T], TResult>,
revert?: boolean
): any
export function map(val: any, iterator: any, revert?: boolean): any {
const res = isArr(val) || isStr(val) ? [] : {}
each(
val,
(item, key) => {
const value = iterator(item, key)
if (isArr(res)) {
;(res as any).push(value)
} else {
res[key] = value
}
},
revert
)
return res
}