===== ISTEM =====
Solve the following programming task.

TASK: Object Diff

Write a function 'objectDiff(obj1, obj2)' that compares two JavaScript objects and returns only the changed properties as [oldValue, newValue].

STARTER CODE (javascript):
function objectDiff(obj1, obj2) {
  // Write your code here
}

module.exports = { objectDiff };


RULES:
- Keep the function name and signature EXACTLY as given.
- Return working code only. No explanations.
- Put the code in a single ``` block.
- Try to solve it first. If you genuinely cannot, write only this single
  line instead of producing faulty code: CANNOT_SOLVE

===== HAM YANIT =====
```javascript
function objectDiff(obj1, obj2) {
  function deepEqual(a, b, seen = new WeakMap()) {
    if (Object.is(a, b)) return true;

    if (
      a === null ||
      b === null ||
      typeof a !== "object" ||
      typeof b !== "object"
    ) {
      return false;
    }

    if (a instanceof Date && b instanceof Date) {
      return a.getTime() === b.getTime();
    }

    if (a instanceof RegExp && b instanceof RegExp) {
      return a.toString() === b.toString();
    }

    if (Array.isArray(a) !== Array.isArray(b)) return false;

    if (seen.has(a)) {
      return seen.get(a) === b;
    }

    seen.set(a, b);

    const keysA = Object.keys(a);
    const keysB = Object.keys(b);

    if (keysA.length !== keysB.length) return false;

    for (const key of keysA) {
      if (!Object.prototype.hasOwnProperty.call(b, key)) return false;
      if (!deepEqual(a[key], b[key], seen)) return false;
    }

    return true;
  }

  const diff = {};
  const keys = new Set([
    ...Object.keys(obj1 || {}),
    ...Object.keys(obj2 || {})
  ]);

  for (const key of keys) {
    const has1 = Object.prototype.hasOwnProperty.call(obj1 || {}, key);
    const has2 = Object.prototype.hasOwnProperty.call(obj2 || {}, key);

    if (!has1 || !has2 || !deepEqual(obj1[key], obj2[key])) {
      diff[key] = [has1 ? obj1[key] : undefined, has2 ? obj2[key] : undefined];
    }
  }

  return diff;
}

module.exports = { objectDiff };
```