@sprucelabs/schema
Version:
Static and dynamic binding plus runtime validation and transformation to ensure your app is sound. 🤓
16 lines (15 loc) • 482 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = areSchemasTheSame;
function areSchemasTheSame(left, right) {
if (left.id !== right.id) {
return false;
}
const fields1 = Object.keys(left.fields ?? {}).sort();
const fields2 = Object.keys(right.fields ?? {}).sort();
if (fields1.join('|') !== fields2.join('|')) {
return false;
}
// TODO let fields compare their definitions
return true;
}