This pull request, is to solve #9, indeed make no observable difference for almost all scenarios. It just bother me sometimes when debugging.
Given the following passed unit case. Only the running order are reversed when traverse with functions returning tasks.
it('traverses the list of tasks returning Task', (done) => {
const Task = require('data.task')
const buildTask = (n) => new Task((rej, res) => {
console.log(n) // --> prints 3 2 1, showing it runs in reverse order
res(n)
})
const listOfFns = List.of(()=>buildTask(1), ()=>buildTask(2), ()=>buildTask(3))
listOfFns.traverse(Task.of, f => f())
.fork(done, x => {
assert.deepEqual(x, List.of(1,2,3)) // --> it returns in right order
done()
})
})
This pull request, is to solve #9, indeed make no observable difference for almost all scenarios. It just bother me sometimes when debugging.
Given the following passed unit case. Only the running order are reversed when traverse with functions returning tasks.