From de52bc35a15dd7ba2029032aaa8c47e357ffd84a Mon Sep 17 00:00:00 2001 From: Saifullah Siddique Date: Wed, 15 Oct 2025 13:05:30 +0530 Subject: [PATCH] fix: replace deprecated util.isArray with Array.isArray Replaced usage of `util.isArray()` with the modern `Array.isArray()` in flash.js to resolve Node.js deprecation warning [DEP0044]. - Removed import of `util.isArray` - Updated conditional check to use `Array.isArray(msg)` instead - Added inline comment to clarify the change This update ensures compatibility with current and future versions of Node.js and eliminates the runtime warning. --- lib/flash.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/flash.js b/lib/flash.js index a278bc1..07600a1 100644 --- a/lib/flash.js +++ b/lib/flash.js @@ -2,7 +2,7 @@ * Module dependencies. */ var format = require('util').format; -var isArray = require('util').isArray; +// var isArray = require('util').isArray; // Deprecated in Node.js — replaced with Array.isArray() /** @@ -64,7 +64,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)) { // Replaced deprecated util.isArray with Array.isArray msg.forEach(function(val){ (msgs[type] = msgs[type] || []).push(val); });