mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-20 23:47:23 -06:00
WebUI: prefer arrow functions whenever applicable
Compared to plain function, arrow function is simpler to understand (without bindings to `this`, `arguments`, `super`) and to read. Now, plain function will only be used when this object is required. PR #21691.
This commit is contained in:
@@ -46,21 +46,21 @@ window.qBittorrent.Filesystem ??= (() => {
|
||||
/**
|
||||
* Returns the file extension part of a file name.
|
||||
*/
|
||||
const fileExtension = function(filename) {
|
||||
const fileExtension = (filename) => {
|
||||
const pointIndex = filename.lastIndexOf(".");
|
||||
if (pointIndex === -1)
|
||||
return "";
|
||||
return filename.substring(pointIndex + 1);
|
||||
};
|
||||
|
||||
const fileName = function(filepath) {
|
||||
const fileName = (filepath) => {
|
||||
const slashIndex = filepath.lastIndexOf(PathSeparator);
|
||||
if (slashIndex === -1)
|
||||
return filepath;
|
||||
return filepath.substring(slashIndex + 1);
|
||||
};
|
||||
|
||||
const folderName = function(filepath) {
|
||||
const folderName = (filepath) => {
|
||||
const slashIndex = filepath.lastIndexOf(PathSeparator);
|
||||
if (slashIndex === -1)
|
||||
return "";
|
||||
|
||||
Reference in New Issue
Block a user