Skip to content

Instantly share code, notes, and snippets.

@rbren
Last active September 29, 2017 21:47
Show Gist options
  • Save rbren/7456682591b0147c5a1b1c8b86d70be2 to your computer and use it in GitHub Desktop.
Save rbren/7456682591b0147c5a1b1c8b86d70be2 to your computer and use it in GitHub Desktop.
let hn = require('@datafire/hacker_news').create();
(async () => {
let user1 = await hn.getUser({username: 'sama'});
let user2 = await hn.getUser({username: 'pg'});
let [more, less] = [user1, user2].sort((a, b) => b.karma - a.karma);
console.log(`${more.id} has more karma (${more.karma}) than ${less.id} (${less.karma})`);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment