code: function setProjection( element, options ) {
      var width = options.width || element.offsetWidth;
      var height = options.height || element.offsetHeight;
      var projection, path;
      if ( options && typeof options.scope === 'undefined') {
        options.scope = 'world';
      }
  
      if ( options.scope === 'usa' ) {
        projection = d3.geo.albersUsa()
          .scale(width)
          .translate([width / 2, height / 2]);
      }
      else if ( options.scope === 'world' ) {
        projection = d3.geo[options.projection]()
          .scale((width + 1) / 2 / Math.PI)
          .translate([width / 2, height / (options.projection === "mercator" ? 1.45 : 1.8)]);
      }
  
      path = d3.geo.path()
        .projection( projection );
  
      return {path: path, projection: projection};
    }
docs: setProjection takes the svg element and options