Closed Richienb closed 4 years ago
If a function that is supposed to return data, uses a .task function, the only way to pass data back out of the scope is like this:
.task
const tempy = require('tempy'); module.exports = async () => { let result await tempy.file.task(tempFile => { // Use tempFile result = ... }) return result }
Since .task functions don't already return something, they could simply reflect the returned values:
const tempy = require('tempy'); module.exports = async () => { return await tempy.file.task(tempFile => { // Use tempFile return ... }) }
Good idea 👍🏻
If a function that is supposed to return data, uses a
.task
function, the only way to pass data back out of the scope is like this:Since
.task
functions don't already return something, they could simply reflect the returned values: