===== 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 isObject(v) {
    return v !== null && typeof v === 'object';
  }

  function deepEqual(a, b) {
    if (a === b) return true;
    if (typeof a === 'number' && typeof b === 'number' && isNaN(a) && isNaN(b)) return true;
    if (!isObject(a) || !isObject(b)) return false;
    if (a instanceof Date && b instanceof Date) return a.getTime() === b.getTime();
    if (Array.isArray(a) !== Array.isArray(b)) return false;
    if (Array.isArray(a)) {
      if (a.length !== b.length) return false;
      for (let i = 0; i < a.length; i++) {
        if (!deepEqual(a[i], b[i])) return false;
      }
      return true;
    }
    const keysA = Object.keys(a);
    const keysB = Object.keys(b);
    if (keysA.length !== keysB.length) return false;
    for (const k of keysA) {
      if (!Object.prototype.hasOwnProperty.call(b, k)) return false;
      if (!deepEqual(a[k], b[k])) return false;
    }
    return true;
  }

  const a = isObject(obj1) ? obj1 : {};
  const b = isObject(obj2) ? obj2 : {};
  const result = {};
  const keys = new Set([...Object.keys(a), ...Object.keys(b)]);

  for (const key of keys) {
    const oldVal = a[key];
    const newVal = b[key];
    if (!deepEqual(oldVal, newVal)) {
      result[key] = [oldVal, newVal];
    }
  }

  return result;
}

module.exports = { objectDiff };
```