build/scripts/ng-map.debug.js
function(filtered) {
      var controlOptions = {};
      if (typeof filtered != 'object') {
        return false;
      }

      for (var attr in filtered) {
        if (filtered[attr]) {
          if (!attr.match(/(.*)ControlOptions$/)) {
            continue; // if not controlOptions, skip it
          }

          //change invalid json to valid one, i.e. {foo:1} to {"foo": 1}
          var orgValue = filtered[attr];
          var newValue = orgValue.replace(/'/g, '"');
          newValue = newValue.replace(/([^"]+)|("[^"]+")/g, function($0, $1, $2) {
            if ($1) {
              return $1.replace(/([a-zA-Z0-9]+?):/g, '"$1":');
            } else {
              return $2;
            }
          });
          try {
            var options = JSON.parse(newValue);
            for (var key in options) { //assign the right values
              if (options[key]) {
                var value = options[key];
                if (typeof value === 'string') {
                  value = value.toUpperCase();
                } else if (key === "mapTypeIds") {
                  value = value.map( function(str) {
                    if (str.match(/^[A-Z]+$/)) { // if constant
                      return google.maps.MapTypeId[str.toUpperCase()];
                    } else { // else, custom map-type
                      return str;
                    }
                  });
                }

                if (key === "style") {
                  var str = attr.charAt(0).toUpperCase() + attr.slice(1);
                  var objName = str.replace(/Options$/,'')+"Style";
                  options[key] = google.maps[objName][value];
                } else if (key === "position") {
                  options[key] = google.maps.ControlPosition[value];
                } else {
                  options[key] = value;
                }
              }
            }
            controlOptions[attr] = options;
          } catch (e) {
            console.error('invald option for', attr, newValue, e, e.stack);
          }
        }
      } // for

      return controlOptions;
    }
function(filtered) {
      var controlOptions = {};
      if (typeof filtered != 'object') {
        return false;
      }

      for (var attr in filtered) {
        if (filtered[attr]) {
          if (!attr.match(/(.*)ControlOptions$/)) {
            continue; // if not controlOptions, skip it
          }

          //change invalid json to valid one, i.e. {foo:1} to {"foo": 1}
          var orgValue = filtered[attr];
          var newValue = orgValue.replace(/'/g, '"');
          newValue = newValue.replace(/([^"]+)|("[^"]+")/g, function($0, $1, $2) {
            if ($1) {
              return $1.replace(/([a-zA-Z0-9]+?):/g, '"$1":');
            } else {
              return $2;
            }
          });
          try {
            var options = JSON.parse(newValue);
            for (var key in options) { //assign the right values
              if (options[key]) {
                var value = options[key];
                if (typeof value === 'string') {
                  value = value.toUpperCase();
                } else if (key === "mapTypeIds") {
                  value = value.map( function(str) {
                    if (str.match(/^[A-Z]+$/)) { // if constant
                      return google.maps.MapTypeId[str.toUpperCase()];
                    } else { // else, custom map-type
                      return str;
                    }
                  });
                }

                if (key === "style") {
                  var str = attr.charAt(0).toUpperCase() + attr.slice(1);
                  var objName = str.replace(/Options$/,'')+"Style";
                  options[key] = google.maps[objName][value];
                } else if (key === "position") {
                  options[key] = google.maps.ControlPosition[value];
                } else {
                  options[key] = value;
                }
              }
            }
            controlOptions[attr] = options;
          } catch (e) {
            console.error('invald option for', attr, newValue, e, e.stack);
          }
        }
      } // for

      return controlOptions;
    }
function ( filtered ) { var controlOptions = { } ; if ( typeof filtered != 'object' ) { return false ; } for ( var attr in filtered ) { if ( filtered [ attr ] ) { if ( ! attr . match ( / (.*)ControlOptions$ / ) ) { continue ; // if not controlOptions, skip it } //change invalid json to valid one, i.e. {foo:1} to {"foo": 1} var orgValue = filtered [ attr ] ; var newValue = orgValue . replace ( / ' / g , '"' ) ; newValue = newValue . replace ( / ([^"]+)|("[^"]+") / g , function ( $0 , $1 , $2 ) { if ( $1 ) { return $1 . replace ( / ([a-zA-Z0-9]+?): / g , '"$1":' ) ; } else { return $2 ; } } ) ; try { var options = JSON . parse ( newValue ) ; for ( var key in options ) { //assign the right values if ( options [ key ] ) { var value = options [ key ] ; if ( typeof value === 'string' ) { value = value . toUpperCase ( ) ; } else if ( key === "mapTypeIds" ) { value = value . map ( function ( str ) { if ( str . match ( / ^[A-Z]+$ / ) ) { // if constant return google . maps . MapTypeId [ str . toUpperCase ( ) ] ; } else { // else, custom map-type return str ; } } ) ; } if ( key === "style" ) { var str = attr . charAt ( 0 ) . toUpperCase ( ) + attr . slice ( 1 ) ; var objName = str . replace ( / Options$ / , '' ) + "Style" ; options [ key ] = google . maps [ objName ] [ value ] ; } else if ( key === "position" ) { options [ key ] = google . maps . ControlPosition [ value ] ; } else { options [ key ] = value ; } } } controlOptions [ attr ] = options ; } catch ( e ) { console . error ( 'invald option for' , attr , newValue , e , e . stack ) ; } } } // for return controlOptions ; }
control means map controls, i.e streetview, pan, etc, not a general control
@memberof Attr2MapOptions
@param {Hash} filtered filtered tag attributes
@returns {Hash} Google Map options
control means map controls i . e streetview pan etc not a general control