I have an Object that looks like this
const companyObj =
{
Advice_Charge: "B. In service / product cost"
Org_Advisory: "B. 1-3"
Org_Developers: "A. None"
Org_MainCategory: "Business services and sales"
Org_Name: "A1 Orchard Spreading"
Org_Size_Facing: "B. 1-3"
Org_SubCategory: "Contractor - Harvesting and cultivation"
}
I have another object that looks like this
const sizeMap = {
'A. None': '11-30',
'B. 1-3': '1-3',
'C. 4-10': '4-10',
'D. 11 - 30': '11-30',
'E. 31 - 100': '31-100',
'F. 100 - 300': '100-300',
'G. 301 - 1000': '301-1000',
'H. 1,000+': '1000 +',
'J. ???': '1-3',
}
I am trying to change one of the properties inside the object using the sizeMap
I want companyObj to look like this
{Org_Size_Facing: '1-3'} // I don't really care about the other properties at this point..
Basically if companyObj.Org_Size_Facing returns any of the fields from sizeMap sizeMap should then return the appropriate value
I have tried
console.log(
'objAsign',
Object.assign(companyObj.Org_Size_Facing, sizeMap['Org_Size_Facing']),
)
This is way off, but I'm sure you guys get the idea of it
Would appreciate any help you guys can offer