HowProgrammingWorks / HowProgrammingWorks/AsynchronousProgramming
`.do` arguments not passed correctly
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 23
- Forks
- 26
- PR merge metrics
- No merged PRs in 30d
Description
The current implementation of the callback chain in 5a-chain passes data from the previous callback but doesn't pass arguments explicitly mentioned in .do().
In usage example readConfig callback is expected to receive myConfig as an argument.
const startChain = chain()
.do(readConfig, 'myConfig')
.do(selectFromDb, 'select * from cities')
.do(getHttpPage, 'http://kpi.ua')
.do(readFile, 'README.md');
However it receives undefined instead.
So if callbacks would really depend on the previous one the chain would fail once it was called.
Also, should only the first callback in the chain receive an explicit argument, and the following ones receive their arguments from the previous one? Or should they receive both explicit and implicit arguments?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by inspecting the callback-chain implementation in 5a-chain and the usage example showing readConfig, selectFromDb, getHttpPage, and readFile. Trace how arguments are passed through each .do() call, then verify that the documented callbacks receive the expected explicit and previous-callback arguments instead of undefined.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100