From 7be6c453b637634b598d2c308aa73218d634af9e Mon Sep 17 00:00:00 2001 From: sidharth Date: Thu, 25 Sep 2025 12:07:14 +0530 Subject: [PATCH 1/3] Replace deprecated util.isArray() with Array.isArray() --- lib/flash.js | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/lib/flash.js b/lib/flash.js index a278bc1..4ff142e 100644 --- a/lib/flash.js +++ b/lib/flash.js @@ -1,9 +1,7 @@ /** * Module dependencies. */ -var format = require('util').format; -var isArray = require('util').isArray; - +var format = require("util").format; /** * Expose `flash()` function on requests. @@ -13,14 +11,16 @@ var isArray = require('util').isArray; */ module.exports = function flash(options) { options = options || {}; - var safe = (options.unsafe === undefined) ? true : !options.unsafe; - - return function(req, res, next) { - if (req.flash && safe) { return next(); } + var safe = options.unsafe === undefined ? true : !options.unsafe; + + return function (req, res, next) { + if (req.flash && safe) { + return next(); + } req.flash = _flash; next(); - } -} + }; +}; /** * Queue flash `msg` of the given `type`. @@ -57,15 +57,15 @@ module.exports = function flash(options) { * @api public */ function _flash(type, msg) { - if (this.session === undefined) throw Error('req.flash() requires sessions'); - var msgs = this.session.flash = this.session.flash || {}; + if (this.session === undefined) throw Error("req.flash() requires sessions"); + var msgs = (this.session.flash = this.session.flash || {}); if (type && msg) { // util.format is available in Node.js 0.6+ if (arguments.length > 2 && format) { var args = Array.prototype.slice.call(arguments, 1); msg = format.apply(undefined, args); - } else if (isArray(msg)) { - msg.forEach(function(val){ + } else if (Array.isArray(msg)) { + msg.forEach(function (val) { (msgs[type] = msgs[type] || []).push(val); }); return msgs[type].length; From c7df8a2d64e73e2c709344211c431dfe92c05985 Mon Sep 17 00:00:00 2001 From: sidharth Date: Thu, 25 Sep 2025 12:35:35 +0530 Subject: [PATCH 2/3] Update package name for modern fork --- package.json | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index bc46300..aadb15b 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,13 @@ { - "name": "connect-flash", + "name": "connect-flash-modern", "version": "0.1.1", "description": "Flash message middleware for Connect.", - "keywords": ["connect", "express", "flash", "messages"], + "keywords": [ + "connect", + "express", + "flash", + "messages" + ], "repository": { "type": "git", "url": "git://github.com/jaredhanson/connect-flash.git" @@ -15,18 +20,21 @@ "email": "jaredhanson@gmail.com", "url": "http://www.jaredhanson.net/" }, - "licenses": [ { - "type": "MIT", - "url": "http://www.opensource.org/licenses/MIT" - } ], + "licenses": [ + { + "type": "MIT", + "url": "http://www.opensource.org/licenses/MIT" + } + ], "main": "./lib", - "dependencies": { - }, + "dependencies": {}, "devDependencies": { "vows": "0.6.x" }, "scripts": { "test": "NODE_PATH=lib node_modules/.bin/vows test/*-test.js" }, - "engines": { "node": ">= 0.4.0" } + "engines": { + "node": ">= 0.4.0" + } } From f58756614b2c217f376ee8e4c2b9dbc154bea9e3 Mon Sep 17 00:00:00 2001 From: sidharthcodes-arch Date: Thu, 25 Sep 2025 13:07:13 +0530 Subject: [PATCH 3/3] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index aadb15b..2cee0a5 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "connect-flash-modern", + "name": "connect-flash", "version": "0.1.1", "description": "Flash message middleware for Connect.", "keywords": [