I have a project where I am working on conditional rules for a form. At this point I have two object where one are the conditions and the other are the filled in form fields which I need to check against the conditions.
I've got as far as making both of the objects, next logical step for me would be an if statement which checks whether or not the form object contains all of the condition object's values. (correct me if I am wrong)
I'll show both of my objects here:
let conditions = {
carrier: "PostNL",
country: "Deutschland"
}
let ticket_data = {
carrier: "PostNL",
client: "testdata",
comment: "testdata",
country: "Deutschland",
postal_code: "testdata",
service_level: "testdata",
}
As you can see, the object ticket_data contains all of the data the object conditions contains. In this case the if statement should return true. However, if one of the values wouldn't exist or wouldn't be equal to the conditions object it should return false.
What would be the best and easiest way to execute this?