function _transformCallbackFunction (callbackFunction, numberOfCallbackInputs, numberOfArrays) {
  if (numberOfCallbackInputs === numberOfArrays) {
    return callbackFunction
  } else if (numberOfCallbackInputs === numberOfArrays + 1) {
    return function (...args) {
      const vals = args.slice(0, numberOfArrays)
      const idx = _transformDims(args[numberOfArrays])
      return callbackFunction(...vals, idx)
    }
  } else if (numberOfCallbackInputs > numberOfArrays + 1) {
    return function (...args) {
      const vals = args.slice(0, numberOfArrays)
      const idx = _transformDims(args[numberOfArrays])
      const rest = args.slice(numberOfArrays + 1)
      return callbackFunction(...vals, idx, ...rest)
    }
  } else {
    return callbackFunction
  }
}
Transforms the callback function based on the number of callback inputs and arrays.
There are three cases:
1. The callback function has N arguments.
2. The callback function has N+1 arguments.
3. The callback function has 2N+1 arguments.

@param {Function} callbackFunction - The callback function to transform.
@param {number} numberOfCallbackInputs - The number of callback inputs.
@param {number} numberOfArrays - The number of arrays.
@returns {Function} The transformed callback function.