From 6f40f6458a6ef479ad4c807933b658f718dbf04f Mon Sep 17 00:00:00 2001 From: Ayoub-Mabrouk Date: Sun, 3 Nov 2024 21:06:17 +0100 Subject: [PATCH] Refactor: Simplify `req.xhr` getter by removing redundant function name The function name `xhr` was removed as it is clear from the property definition. This change improves readability and follows best practices for concise function expressions. --- lib/request.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/request.js b/lib/request.js index 372a9915e9..f77fdb558b 100644 --- a/lib/request.js +++ b/lib/request.js @@ -493,8 +493,8 @@ defineGetter(req, 'stale', function stale(){ * @public */ -defineGetter(req, 'xhr', function xhr(){ - var val = this.get('X-Requested-With') || ''; +defineGetter(req, 'xhr', function() { + const val = this.get('X-Requested-With') || ''; return val.toLowerCase() === 'xmlhttprequest'; });