UNPKG

sanity

Version:

Sanity is a real-time content infrastructure with a scalable, hosted backend featuring a Graph Oriented Query Language (GROQ), asset pipelines and fast edge caches

15 lines (14 loc) 438 B
export function hasEqualFields(fields: string[]) { return (object: Record<string, any> | null, otherObject: Record<string, any> | null) => { if (object === otherObject) { return true } if (!object || !otherObject) { return false } if (typeof object !== 'object' || typeof otherObject !== 'object') { return false } return fields.every((field) => object[field] === otherObject[field]) } }