// these two lines are equivalent await a, b, c, d = moo(1, 2, 3); moo(1, 2, 3, function(a, b, c, d) {} );
// ...these two lines would be also equivalent await error, foo = bar(1, 2, 3); bar(1, 2, 3, function(error, foo) {} );
Here's a concrete example. Normally in Node you do something like this:
fs.readFile('/etc/passwd', function (err, data) { if (err) { // handle error } // normal processing });
await err, data = fs.readFile('/etc/passwd'); if (err) { // handle error } // normal processing
try { await data = fs.readFile('/etc/passwd'); // normal processing } catch (error) { // handle error }
try await foo = bar(baz)
await error, foo = bar(baz) if (error) throw error