News for hackers. Stuff that matters.
Re:Never Mix Promises and Callbacks in NodeJS by spankalee on Friday April 07, 2017 @12:55PM (#14061354)
I like this!

For golfing purposes, you can remove a branch too:

    function fetchFirstUser(isWhatIWant, callback) {
      knex.first().from('users')
        .then((user) => ({ user }), (e) => ({ e }))
        .then(({ user, e }) => callback(e, user))
        .catch((e) => console.error(e));
    }

There are no comments on this comment yet.