jaredhanson / jaredhanson/connect-flash
util.isArray exception fix required.
- Dominant language
- JavaScript
- Stars
- 1.2k
- Forks
- 173
- PR merge metrics
- No merged PRs in 30d
Description
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used [patch-package](https://github.com/ds300/patch-package) to patch `connect-flash@0.1.1` for the project I'm working on.
Here is the diff that solved my problem:
```diff
diff --git a/node_modules/connect-flash/lib/flash.js b/node_modules/connect-flash/lib/flash.js
index a278bc1..0175ab5 100644
--- a/node_modules/connect-flash/lib/flash.js
+++ b/node_modules/connect-flash/lib/flash.js
@@ -2,8 +2,6 @@
* Module dependencies.
*/
var format = require('util').format;
-var isArray = require('util').isArray;
-
/**
* Expose `flash()` function on requests.
@@ -64,7 +62,7 @@ function _flash(type, msg) {
if (arguments.length > 2 && format) {
var args = Array.prototype.slice.call(arguments, 1);
msg = format.apply(undefined, args);
- } else if (isArray(msg)) {
+ } else if (Array.isArray(msg)) {
msg.forEach(function(val){
(msgs[type] = msgs[type] || []).push(val);
});
```
This issue body was [partially generated by patch-package](https://github.com/ds300/patch-package/issues/296).
Contributor guide
No contributing guide indexed for this repository
Research direction
Review lib/flash.js, focusing on the array check in _flash and the surrounding message-handling logic. Run the project's existing tests, then verify the reported exception is resolved and the flash middleware continues to handle array messages correctly.
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
- Clearly specified
- Newbie friendliness
- 70/100