Skip to content

Commit

Permalink
Slighyly improve RunKit example
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed May 12, 2020
1 parent 0e8582f commit 6f84051
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions documentation/examples/runkit-example.js
@@ -1,4 +1,10 @@
const got = require("got");
const ISS = "http://api.open-notify.org/iss-now.json";
const got = require('got');

(await got(ISS).json()).iss_position;
(async () => {
const issUrl = 'http://api.open-notify.org/iss-now.json';

const {iss_position: issPosition} = await got(issUrl).json();

console.log(issPosition);
//=> {latitude: '20.4956', longitude: '42.2216'}
})();

4 comments on commit 6f84051

@Giotino
Copy link
Collaborator

@Giotino Giotino commented on 6f84051 May 13, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One of the features of having

(await got(ISS).json()).iss_position;

as the last line was that Runkit showed a map with the coordinates.
chrome_3HlgbulGHp

@szmarczak
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sindresorhus Can you revert this?

@sindresorhus
Copy link
Owner Author

@sindresorhus sindresorhus commented on 6f84051 May 13, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While nice, that is unrelated to showing off Got, which this example is about. It's not about showing off RunKit features. I'd rather have readable code.

@szmarczak
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually it still opens the map if you click the dropdown icon :)

Please sign in to comment.