css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

Save Automatically?

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              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
    })
}


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

            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console