You could also use rest operator for doing this.
const { type, status,_id, ...rest} = value
const details = {
[type]: {
...rest
}
}
return {...acc, ...details}