Switch entirely to fat arrow functions

This commit is contained in:
John Furrow
2016-03-19 12:46:11 +01:00
parent 14ed9bb1f5
commit e77dfac3ae
33 changed files with 145 additions and 159 deletions
+2 -2
View File
@@ -7,13 +7,13 @@ export function filterTorrents(torrentList, opts) {
if (filter !== 'all') {
if (type === 'status') {
let statusFilter = statusMap[filter];
return torrentList.filter(function(torrent) {
return torrentList.filter((torrent) => {
if (torrent.status.indexOf(statusFilter) > -1) {
return torrent;
}
});
} else if (type === 'tracker') {
return torrentList.filter(function(torrent) {
return torrentList.filter((torrent) => {
if (torrent.trackers.indexOf(filter) > -1) {
return torrent;
}
+3 -3
View File
@@ -1,7 +1,7 @@
import React from 'react';
const format = {
eta: function(eta) {
eta: (eta) => {
if (eta === 'Infinity') {
return '∞';
} else if (eta.years > 0) {
@@ -68,7 +68,7 @@ const format = {
}
},
data: function(bytes, extraUnits, precision = 2) {
data: (bytes, extraUnits, precision = 2) => {
let kilobyte = 1024,
megabyte = kilobyte * 1024,
gigabyte = megabyte * 1024,
@@ -106,7 +106,7 @@ const format = {
};
},
ratio: function(ratio) {
ratio: (ratio) => {
ratio = ratio / 1000;
let precision = 1;
+2 -2
View File
@@ -8,7 +8,7 @@ export function selectTorrents(options) {
let lastHashIndex;
// get the index of the last selected torrent.
options.torrentList.some(function(torrent, index) {
options.torrentList.some((torrent, index) => {
if (torrent.hash === lastHash) {
lastHashIndex = index;
return true;
@@ -16,7 +16,7 @@ export function selectTorrents(options) {
});
// get the index of the newly selected torrent.
options.torrentList.some(function(torrent, index) {
options.torrentList.some((torrent, index) => {
if (torrent.hash === options.hash) {
currentHashIndex = index;
return true;
+1 -1
View File
@@ -7,7 +7,7 @@ export function sortTorrents(torrentsHash, sortBy) {
let direction = sortBy.direction;
let property = sortBy.property;
torrents.sort(function(a, b) {
torrents.sort((a, b) => {
let valA = a[property];
let valB = b[property];
@@ -5,7 +5,7 @@ import propsMap from '../../../../shared/constants/propsMap';
export function torrentStatusClasses(torrent, ...classes) {
let additionalClasses = [];
classes.forEach(function (className) {
classes.forEach((className) => {
if (className) {
additionalClasses.push(className);
}