I have the following nested Object
const ERR_CODES = {
INVALID_CONSUMER_ID: {
code: 1000,
message: 'Invalid Consumer ID',
},
INVALID_MOBILE: {
code: 1001,
message: 'Invalid Mobile Number',
},
INVALID_ZIPCODE: {
code: 1002,
message: 'Invalid Zipcode',
},
INVALID_FIRST_NAME: {
code: 1000,
message: 'First Name',
},
}
I want to throw an error when two objects have the same code, like in the example consumer id and first name both have 1000 for error codes. What is the fastest way to go through my ERR_CODES
obj and see if any code repeats?