What about merge into one block:
```
// 1. Check validation of callback for addEventListener way
// 2. Check validation of callback for oncontactschanged way, it can be null or a function
if (!isOnChange && (typeof callback !== 'function')
   || isOnChange && (callback !== null || typeof callback !== 'function')) {
  console.log("Invalid parameters of callback!");
  return -1;
}
```