MCPcopy
hub / github.com/chartdb/chartdb / areCommentsDifferent

Function areCommentsDifferent

src/lib/domain/diff/diff-check/diff-check.ts:81–100  ·  view source on GitHub ↗
(
    oldComment: string | undefined | null,
    newComment: string | undefined | null
)

Source from the content-addressed store, hash-verified

79 * Returns true if the comments are semantically different (i.e., a real change).
80 */
81const areCommentsDifferent = (
82 oldComment: string | undefined | null,
83 newComment: string | undefined | null
84): boolean => {
85 const normalizedOld = normalizeComment(oldComment);
86 const normalizedNew = normalizeComment(newComment);
87
88 // Both undefined/empty means equal
89 if (!normalizedOld && !normalizedNew) {
90 return false;
91 }
92
93 // One defined, one not means different
94 if (!normalizedOld || !normalizedNew) {
95 return true;
96 }
97
98 // Compare normalized versions
99 return normalizedOld !== normalizedNew;
100};
101
102// Helper to determine if an attribute change should add to the changed map
103// - undefined: always add (current behavior)

Callers 3

compareTablesFunction · 0.85
compareFieldPropertiesFunction · 0.85
compareNotesFunction · 0.85

Calls 1

normalizeCommentFunction · 0.85

Tested by

no test coverage detected