Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor: Simplify req.xhr getter by removing redundant function name #6132

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
  • Loading branch information
Ayoub-Mabrouk committed Nov 3, 2024
commit 6f40f6458a6ef479ad4c807933b658f718dbf04f
4 changes: 2 additions & 2 deletions lib/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
});

Expand Down