analytics.js
function toFunction(obj) {
  switch ({}.toString.call(obj)) {
    case '[object Object]':
      return objectToFunction(obj);
    case '[object Function]':
      return obj;
    case '[object String]':
      return stringToFunction(obj);
    case '[object RegExp]':
      return regexpToFunction(obj);
    default:
      return defaultToFunction(obj);
  }
}
function toFunction(obj) {
  switch ({}.toString.call(obj)) {
    case '[object Object]':
      return objectToFunction(obj);
    case '[object Function]':
      return obj;
    case '[object String]':
      return stringToFunction(obj);
    case '[object RegExp]':
      return regexpToFunction(obj);
    default:
      return defaultToFunction(obj);
  }
}
function toFunction ( obj ) { switch ( { } . toString . call ( obj ) ) { case '[object Object]' : return objectToFunction ( obj ) ; case '[object Function]' : return obj ; case '[object String]' : return stringToFunction ( obj ) ; case '[object RegExp]' : return regexpToFunction ( obj ) ; default : return defaultToFunction ( obj ) ; } }
Convert `obj` to a `Function`.

@param {Mixed} obj
@return {Function}
@api private
Convert obj to a Function .