erikjung
2/3/2018 - 12:07 AM

renameProps.js

export default const renameProps = (map, obj) =>
  Object.entries(map).reduce((accum, [a, b]) => {
    delete accum[a]
    return obj[a] 
      ? Object.assign(accum, {[b]: obj[a]})
      : accum
  }, {...obj})