jaredhanson / jaredhanson/connect-flash
Wrong example checking for message
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 1.2k
- Forks
- 173
- PR merge metrics
- No merged PRs in 30d
Description
The examples show that this `if (message) {` is the proper way to check if a message is there, actually this will be true every time, even if no message is set. It seems to work with:
``` js
if (message.length !== 0) {
```
I am not sure, but it seems that message, when empty is an empty object (`{}`) so checking for it will be true in any case.
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
Review the JavaScript examples that use `if (message) {` and verify how an empty message is represented. Confirm the condition behaves incorrectly for an empty object, then update the example so it checks for an actually present message and verify the corrected behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100