Skip to content

Commit

Permalink
style: fix formatting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
mrfelton committed Feb 16, 2023
1 parent a56704a commit efb2deb
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/lib/cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const cache = (binaryPath, cachePath) => {
log.info(pkg.name, 'Cached binary to', cachedBinary)
resolve()
})
.on('error', function(err) {
.on('error', function (err) {
log.error(pkg.name, 'Failed to cache binary:', err)
reject(err)
})
Expand Down
2 changes: 1 addition & 1 deletion src/lib/extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ function getBinaryPath() {
* @api public
*/
function getCachePathCandidates() {
return [process.env.npm_config_lnd_binary_cache, process.env.npm_config_cache].filter(function(_) {
return [process.env.npm_config_lnd_binary_cache, process.env.npm_config_cache].filter(function (_) {
return _
})
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/extract.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const extract = (archive, dest) => {
const isWindows = support.isWindows(lnd.getBinaryPlatform())
const stream = fs.createReadStream(archive)

const moveToDest = cb => {
const moveToDest = (cb) => {
log.info(pkg.name, 'Extracted lnd archive to', archiveDir)

// Make sure the binary is executable.
Expand Down
6 changes: 3 additions & 3 deletions src/lib/fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const fetch = (url, dest) => {
},
downloadoptions,
),
).then(response => {
).then((response) => {
// return a promise and resolve when download finishes
return new Promise((resolve, reject) => {
// Pipe the data into a temporary file.
Expand All @@ -40,7 +40,7 @@ export const fetch = (url, dest) => {

log.enableProgress()

response.data.on('data', chunk => progress.completeWork(chunk.length))
response.data.on('data', (chunk) => progress.completeWork(chunk.length))
response.data.on('end', progress.finish)
}

Expand All @@ -49,7 +49,7 @@ export const fetch = (url, dest) => {
resolve(tmpFile)
})

response.data.on('error', err => {
response.data.on('error', (err) => {
debug('Download error')
reject(err)
})
Expand Down
4 changes: 2 additions & 2 deletions src/lib/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export const install = () => {
}

return cacache.tmp
.withTmp(lnd.getTmpDir(), { tmpPrefix: 'lnd-downloads' }, tmpDir => {
.withTmp(lnd.getTmpDir(), { tmpPrefix: 'lnd-downloads' }, (tmpDir) => {
return fetch(binaryUrl, tmpDir)
.then(verify)
.then(() => {
Expand All @@ -79,5 +79,5 @@ export const install = () => {
fileName: lnd.getBinaryName(),
installPath: path.dirname(binaryPath),
}))
.catch(err => log.error(pkg.name, err))
.catch((err) => log.error(pkg.name, err))
}
6 changes: 3 additions & 3 deletions src/lib/support.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ const supportedArchs = ['amd64', '386', 'arm']
const supportedVersions = Object.keys(manifest)

// Check functions
const isSupportedVersion = version => supportedVersions.indexOf(version) !== -1
const isSupportedPlatform = platform => supportedPlatforms.indexOf(platform) !== -1
const isSupportedArch = arch => supportedArchs.indexOf(arch) !== -1
const isSupportedVersion = (version) => supportedVersions.indexOf(version) !== -1
const isSupportedPlatform = (platform) => supportedPlatforms.indexOf(platform) !== -1
const isSupportedArch = (arch) => supportedArchs.indexOf(arch) !== -1

// Is the platform Windows?
function isWindows(os) {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/util/downloadoptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import useragent from './useragent'
* @return {Object} an options object for request
* @api private
*/
export const downloadoptions = function() {
export const downloadoptions = function () {
var options = {
timeout: 60000,
headers: {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/util/proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
* @return {String} the proxy configured by npm or an empty string
* @api private
*/
export const proxy = function() {
export const proxy = function () {
return process.env.npm_config_https_proxy || process.env.npm_config_proxy || process.env.npm_config_http_proxy || ''
}
2 changes: 1 addition & 1 deletion src/lib/util/useragent.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ import * as pkg from '../../../package.json'
*
* @api private
*/
export const useragent = function() {
export const useragent = function () {
return ['node/', process.version, ' ', 'node-lnd-installer/', pkg.version].join('')
}
8 changes: 4 additions & 4 deletions src/lib/verify.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import createDebug from 'debug'
const debug = createDebug(pkg.name)

// Verify the binary archive.
export const verify = filepath => {
export const verify = (filepath) => {
debug('verify: %o', { filepath })

function getKeyByValue(object, value) {
return Object.keys(object).find(key => object[key] === value)
return Object.keys(object).find((key) => object[key] === value)
}

const manifestPath = path.join(__dirname, '..', '..', 'config', 'manifest.json')
Expand All @@ -35,7 +35,7 @@ export const verify = filepath => {

return hasha
.fromFile(filepath, { algorithm: 'sha256' })
.then(hash => {
.then((hash) => {
debug('Generated hash from downloaded file', hash)

if (checksum === hash) {
Expand All @@ -45,7 +45,7 @@ export const verify = filepath => {
log.error(pkg.name, 'Checksum did not match')
return Promise.reject(new Error('Checksum did not match'))
})
.catch(err => {
.catch((err) => {
log.error(pkg.name, 'Error verifying checksum of downloaded file', err)
return Promise.reject(err)
})
Expand Down

0 comments on commit efb2deb

Please sign in to comment.