Skip to content

Quicker example #3

@Darkle

Description

@Darkle

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 */)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions