2015-08-05 07:25:34 +00:00
|
|
|
import mapValues from 'lodash/object/mapValues';
|
|
|
|
import update from './update';
|
2015-08-05 11:29:30 +00:00
|
|
|
import wrap from './wrap';
|
2015-08-05 07:25:34 +00:00
|
|
|
|
|
|
|
function map(iteratee, object) {
|
2015-08-05 11:29:30 +00:00
|
|
|
const updater = update(iteratee);
|
2015-08-05 07:25:34 +00:00
|
|
|
|
|
|
|
if (Array.isArray(object)) {
|
|
|
|
return object.map(updater);
|
|
|
|
}
|
|
|
|
|
|
|
|
return mapValues(object, updater);
|
|
|
|
}
|
|
|
|
|
2015-08-05 11:29:30 +00:00
|
|
|
export default wrap(map);
|