@sprucelabs/schema
Version:
Static and dynamic binding plus runtime validation and transformation to ensure your app is sound. 🤓
14 lines (13 loc) • 473 B
JavaScript
export default function areSchemasTheSame(left, right) {
var _a, _b;
if (left.id !== right.id) {
return false;
}
const fields1 = Object.keys((_a = left.fields) !== null && _a !== void 0 ? _a : {}).sort();
const fields2 = Object.keys((_b = right.fields) !== null && _b !== void 0 ? _b : {}).sort();
if (fields1.join('|') !== fields2.join('|')) {
return false;
}
// TODO let fields compare their definitions
return true;
}