Skip to content

Commit

Permalink
Merge pull request #1497 from LinusU/prefer-const
Browse files Browse the repository at this point in the history
Prefer const over let
  • Loading branch information
mathiasvr committed Oct 11, 2018
2 parents fa7d917 + ffb809b commit aef5669
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion bin/extra-lint.js
Expand Up @@ -35,7 +35,7 @@ files.forEach(function (file) {
}

if (error) {
let name = path.basename(file)
const name = path.basename(file)
console.log('%s:%d - %s:\n%s', name, i + 1, error, line)
hasErrors = true
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/index.js
Expand Up @@ -192,7 +192,7 @@ function sliceArgv (argv) {
}

function processArgv (argv) {
let torrentIds = []
const torrentIds = []
argv.forEach(function (arg) {
if (arg === '-n' || arg === '-o' || arg === '-u') {
// Critical path: Only load the 'dialog' package if it is needed
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/controllers/torrent-list-controller.js
Expand Up @@ -318,7 +318,7 @@ module.exports = class TorrentListController {
function findFilesRecursive (paths, cb_) {
if (paths.length > 1) {
let numComplete = 0
let ret = []
const ret = []
paths.forEach(function (path) {
findFilesRecursive([path], function (fileObjs) {
ret.push(...fileObjs)
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/lib/state.js
Expand Up @@ -236,7 +236,7 @@ function saveImmediate (state, cb) {
.filter((x) => x.infoHash)
.map(function (x) {
const torrent = {}
for (let key in x) {
for (const key in x) {
if (key === 'progress' || key === 'torrentKey') {
continue // Don't save progress info or key for the webtorrent process
}
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/lib/telemetry.js
Expand Up @@ -98,7 +98,7 @@ function getSystemInfo () {
function getTorrentStats (state) {
const count = state.saved.torrents.length
let sizeMB = 0
let byStatus = {
const byStatus = {
new: { count: 0, sizeMB: 0 },
downloading: { count: 0, sizeMB: 0 },
seeding: { count: 0, sizeMB: 0 },
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/lib/torrent-poster.js
Expand Up @@ -98,7 +98,7 @@ function scoreAudioCoverFile (imgFile) {
spectrogram: -80
}

for (let keyword in relevanceScore) {
for (const keyword in relevanceScore) {
if (fileName === keyword) {
return relevanceScore[keyword]
}
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/main.js
Expand Up @@ -5,7 +5,7 @@
* actually used because auto-prefixing is disabled with
* `darkBaseTheme.userAgent = false`. Return a fake object.
*/
let Module = require('module')
const Module = require('module')
const _require = Module.prototype.require
Module.prototype.require = function (id) {
if (id === 'inline-style-prefixer') return {}
Expand Down
8 changes: 4 additions & 4 deletions src/renderer/pages/player-page.js
Expand Up @@ -734,14 +734,14 @@ function formatTime (time, total) {
return '0:00'
}

let totalHours = Math.floor(total / 3600)
let totalMinutes = Math.floor(total % 3600 / 60)
let hours = Math.floor(time / 3600)
const totalHours = Math.floor(total / 3600)
const totalMinutes = Math.floor(total % 3600 / 60)
const hours = Math.floor(time / 3600)
let minutes = Math.floor(time % 3600 / 60)
if (totalMinutes > 9) {
minutes = zeroFill(2, minutes)
}
let seconds = zeroFill(2, Math.floor(time % 60))
const seconds = zeroFill(2, Math.floor(time % 60))

return (totalHours > 0 ? hours + ':' : '') + minutes + ':' + seconds
}

0 comments on commit aef5669

Please sign in to comment.