Skip to content

Commit 5293b12

Browse files
authored
Merge pull request #92 from LinusU/prefer-const
Prefer const over let
2 parents 1ac5650 + cc5ad08 commit 5293b12

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@ const filterData = require('./lib/filter-data')
66
module.exports = function (options, callback) {
77
return new Promise(function (resolve, reject) {
88
if (!options) {
9-
let error = new Error('Missing required input: options object')
9+
const error = new Error('Missing required input: options object')
1010
return callback ? callback(error, null) : reject(error)
1111
}
1212

1313
if (!options.url && !options.data) {
14-
let error = new Error('Missing required params: url or data')
14+
const error = new Error('Missing required params: url or data')
1515
return callback ? callback(error, null) : reject(error)
1616
}
1717

1818
if (options.url && !validUrl.isWebUri(options.url)) {
19-
let error = new Error('Invalid url')
19+
const error = new Error('Invalid url')
2020
return callback ? callback(error, null) : reject(error)
2121
}
2222

@@ -29,7 +29,7 @@ module.exports = function (options, callback) {
2929
}
3030

3131
if (response && response.statusCode !== 200) {
32-
let error = new Error('Validator returned unexpected statuscode: ' + response.statusCode)
32+
const error = new Error('Validator returned unexpected statuscode: ' + response.statusCode)
3333
return callback ? callback(error, null) : reject(error)
3434
}
3535

lib/config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module.exports = function (options) {
33
const userAgent = `${pkg.name} v ${pkg.version}`
44
const ignore = options.ignore
55
const format = ignore ? 'text' : options.format || 'json'
6-
let newOpts = {
6+
const newOpts = {
77
uri: 'https://validator.w3.org/nu/',
88
headers: Object.assign({
99
'User-Agent': userAgent

lib/filter-data.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module.exports = function (data, ignore) {
22
const list = data.split('\n')
33
const filters = Array.isArray(ignore) ? ignore : [ignore]
44
let errors = false
5-
let results = []
5+
const results = []
66
list.forEach(function (line, index) {
77
if (line.startsWith('Error') && filters.indexOf(line) === -1) {
88
results.push(line)

0 commit comments

Comments
 (0)