Check object structure when provided an obeject and similar structure with variable types as the values
The value to validate
The required properties and their expected types
Type predicate indicating if the value has minimal required product properties
if ( ! checkObjectStructure(data, { title: "string", price: "number", quantity: "number"})) { throw new Error("data is not complete - " + JSON.stringify(data));} Copy
if ( ! checkObjectStructure(data, { title: "string", price: "number", quantity: "number"})) { throw new Error("data is not complete - " + JSON.stringify(data));}
Check object structure when provided an obeject and similar structure with variable types as the values