Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quicker example #3

Open
Darkle opened this issue Sep 17, 2017 · 0 comments
Open

Quicker example #3

Darkle opened this issue Sep 17, 2017 · 0 comments

Comments

@Darkle
Copy link

Darkle commented Sep 17, 2017

supersniff looks neat and I was thinking if you're quickly debugging it might be a hassle to have to put the import/require statement at the top of each file whenever you want to use it. I was thinking you could also do this:

fetch(`http://myapi.com/users/${username}.json`))
  .then(response => response.json())
  .then(require('supersniff')) // Will console.log out the parsed json, and return the value,
               // effectively passing it on to the next .then
  .then(user => Promise.all(user.friends.map(friend => getFriend(friendId))))
  .then(friends => /* do even more stuff here */)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant