Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                
              
            
!

CSS

              
                
              
            
!

JS

              
                const data = {
  "future": [
    {"name":"Phil Hawksworth","eventName":"Oxford Geek Night","startDate":"2/13/2019","endDate":"2/13/2019","eventCity":"Oxford","eventCountry":"UK","description":"What, why and how to JAMstack","eventUrl":"http://oxford.geeknights.net/ogn49"},{"name":"Phil Hawksworth","eventName":"UpFront Conference","startDate":"3/22/2019","endDate":"3/22/2019","eventCity":"Manchester","eventCountry":"UK","description":"Microservices Mousetrap","eventUrl":"https://upfrontconf.com/"},{"name":"Bhavana Srinivas","eventName":"Spotlight: Web Performance","startDate":"03/23/19","endDate":"03/23/19","eventCity":"Toronto","eventCountry":"Canada","description":"Rise of the JAMstack","eventUrl":"https://fitc.ca/event/perf/presentations/"},{"name":"Divya Sasidharan","eventName":"VueConf","startDate":"3/25/2019","endDate":"03/27/2019","eventCity":"Tampa","eventCountry":"USA","description":"","eventUrl":"http://vueconf.us/"},{"name":"Phil Hawksworth","eventName":"JAMstack Conf NYC","startDate":"4/2/2019","endDate":"4/4/2019","eventCity":"New York","eventCountry":"USA","description":"JAMstack Conference","eventUrl":"https://jamstackconf.com"},{"name":"Divya Sasidharan","eventName":"Stir Trek","startDate":"4/26/2019","endDate":"4/26/2019","eventCity":"Columbus, OH","eventCountry":"USA","description":"Authentication for the REST of us","eventUrl":"https://stirtrek.com/"},{"name":"Phil Hawksworth","eventName":"Front End United","startDate":"5/16/2019","endDate":"5/17/2019","eventCity":"Utrecht","eventCountry":"The Netherlands","description":"Microservices Mousetrap","eventUrl":"https://www.frontendunited.org/"},{"name":"Shawn Wang","eventName":"YGLF Vilnius","startDate":"5/16/2019","endDate":"5/16/2019","eventCity":"Vilnius","eventCountry":"Lithuania","description":"You Gotta Love JAMStack","eventUrl":"https://lithuania.yglfconf.com/"},{"name":"David Calavera","eventName":"Scale Conf","startDate":"5/17/2019","endDate":"5/18/19","eventCity":"Medellín","eventCountry":"Columbia","description":"","eventUrl":"https://scaleconfco.com/"},{"name":"Divya Sasidharan","eventName":"OSCon","startDate":"7/15/2019","endDate":"07/18/2019","eventCity":"Portland, OR","eventCountry":"USA","description":"Smashing the bugs in the Cloud","eventUrl":"https://conferences.oreilly.com/oscon/oscon-or"}],
  "past":[
    {"name":"Phil Hawksworth","eventName":"Fronteers Workshop","startDate":"1/25/2019","endDate":"1/25/2019","eventCity":"Utrecht","eventCountry":"The Netherlands","description":"A one day workshop on Static Site Generators and Netlify","eventUrl":"https://fronteers.nl/workshops/workshop-netlify-static-site-generators"},{"name":"Shawn Wang","eventName":"JS Forward","startDate":"1/26/2019","endDate":"1/26/2019","eventCity":"San Francisco","eventCountry":"USA","description":"","eventUrl":"https://forwardjs.com/"},{"name":"Phil Hawksworth","eventName":"JAMstack Meetup - London","startDate":"2/5/2019","endDate":"2/5/2019","eventCity":"London","eventCountry":"UK","description":"JAMstack Meetup","eventUrl":"https://www.meetup.com/JAMstack-London/events/257961818/"}]
}

var mbClient = new MapboxClient('pk.eyJ1Ijoic2hvcnRkaXYiLCJhIjoiY2l3OGc5YmE5MDJzZjJ5bWhkdDZieGdzcSJ9.1z-swTWtcCHYI_RawDJCEw');

var featureCollection = {
  "type": "FeatureCollection",
  "features": []
}

var getGeoData = function(data) {
    return data.map(async function(dat) {
      var t = await mbClient.geocodeForward(
        `${dat.eventCity}, ${dat.eventCountry}`, { limit: 1 }
      )
      var feature = {
        "type": "Feature",
        "geometry": {
          "type": "Point",
          "coordinates": t.entity.features[0].center
        },
        "properties": { ...dat }
      }
      return feature
    })
}


var transformData = function(data) {
  return Promise.all(getGeoData(data))
    .then(res => {
      return {
        "type": "FeatureCollection",
        "features": res
      }
    })
}

//fucking codepen//
export default {
  default: {
    transformData
  }
}
              
            
!
999px

Console