analytics.js
function objectToFunction(obj) {
  var match = {};
  for (var key in obj) {
    match[key] = typeof obj[key] === 'string'
      ? defaultToFunction(obj[key])
      : toFunction(obj[key]);
  }
  return function(val){
    if (typeof val !== 'object') return false;
    for (var key in match) {
      if (!(key in val)) return false;
      if (!match[key](val[key])) return false;
    }
    return true;
  };
}
function objectToFunction(obj) {
  var match = {};
  for (var key in obj) {
    match[key] = typeof obj[key] === 'string'
      ? defaultToFunction(obj[key])
      : toFunction(obj[key]);
  }
  return function(val){
    if (typeof val !== 'object') return false;
    for (var key in match) {
      if (!(key in val)) return false;
      if (!match[key](val[key])) return false;
    }
    return true;
  };
}
function objectToFunction ( obj ) { var match = { } ; for ( var key in obj ) { match [ key ] = typeof obj [ key ] === 'string' ? defaultToFunction ( obj [ key ] ) : toFunction ( obj [ key ] ) ; } return function ( val ) { if ( typeof val !== 'object' ) return false ; for ( var key in match ) { if ( ! ( key in val ) ) return false ; if ( ! match [ key ] ( val [ key ] ) ) return false ; } return true ; } ; }
Convert `object` to a function.

@param {Object} object
@return {Function}
@api private
Convert object to a function .