All files / lib/core/renderer diff.js

85.71% Statements 12/14
100% Branches 1/1
0% Functions 0/1
85.71% Lines 12/14

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 159x 9x 9x 9x 9x 9x 9x 9x 9x 9x 9x     9x  
/**
 * Provides simple diffing logic for HTML content.
 */
export class HtmlDiff {
  /**
   * Compares two HTML strings and returns the next HTML if they differ.
   * @param {string} currentHtml - The current HTML content.
   * @param {string} nextHtml - The next HTML content.
   * @returns {string|null} The next HTML if it differs from current, otherwise null.
   */
  diff(currentHtml, nextHtml) {
    return currentHtml === nextHtml ? null : nextHtml;
  }
}