Skip to content

Commit e2c2c85

Browse files
committed
misc: Update the standard
1 parent dbd7586 commit e2c2c85

8 files changed

Lines changed: 24 additions & 24 deletions

File tree

index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const languages = ['en'].concat(fs.readdirSync(i18nDir)
77
.filter((f) => f.match(/\w+\.json/))
88
.map((f) => f.replace('.json', ''))
99
)
10-
var jsing = require('workshopper-adventure')({
10+
const jsing = require('workshopper-adventure')({
1111
appDir: __dirname,
1212
languages,
1313
header: require('workshopper-adventure/default/header'),
@@ -18,8 +18,8 @@ jsing.addAll(require('./menu.json').map(function (name) {
1818
return {
1919
name,
2020
fn: function () {
21-
var p = name.toLowerCase().replace(/\s/g, '-')
22-
var dir = require('path').join(__dirname, 'problems', p)
21+
const p = name.toLowerCase().replace(/\s/g, '-')
22+
const dir = require('path').join(__dirname, 'problems', p)
2323
return problem(dir)
2424
}
2525
}

lib/compare-solution.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
require('colors')
22

3-
var path = require('path')
4-
var diff = require('diff')
5-
var run = require(path.join(__dirname, 'run-solution'))
3+
const path = require('path')
4+
const diff = require('diff')
5+
const run = require(path.join(__dirname, 'run-solution'))
66

77
module.exports = function (solution, attempt, i18n, cb) {
88
run(solution, i18n, function (err, solutionResult) {
@@ -31,9 +31,9 @@ module.exports = function (solution, attempt, i18n, cb) {
3131
}
3232

3333
function generateDiff (solution, attempt) {
34-
var parts = diff.diffChars(solution, attempt)
34+
const parts = diff.diffChars(solution, attempt)
3535

36-
var result = ''
36+
let result = ''
3737

3838
parts.forEach(function (part) {
3939
if (part.added) {

lib/footer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var path = require('path')
1+
const path = require('path')
22
module.exports = [
33
{ text: '---', type: 'md' },
44
{ file: path.join(__dirname, '..', 'i18n', 'footer', '{lang}.md') },

lib/get-file.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var fs = require('fs')
1+
const fs = require('fs')
22

33
module.exports = function (filepath) {
44
return fs.readFileSync(filepath, 'utf8')

lib/problem.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
1-
var path = require('path')
2-
var getFile = require('./get-file')
3-
var compare = require('./compare-solution')
1+
const path = require('path')
2+
const getFile = require('./get-file')
3+
const compare = require('./compare-solution')
44

55
module.exports = function createProblem (dirname) {
6-
var exports = {}
6+
const exports = {}
77

8-
var problemName = dirname.split(path.sep)
9-
var i18n
8+
let problemName = dirname.split(path.sep)
9+
let i18n
1010

1111
problemName = problemName[problemName.length - 1]
1212

1313
exports.init = function (workshopper) {
1414
i18n = workshopper.i18n
15-
var postfix = workshopper.i18n.lang() === 'en' ? '' : '_' + workshopper.i18n.lang()
15+
const postfix = workshopper.i18n.lang() === 'en' ? '' : '_' + workshopper.i18n.lang()
1616
this.problem = { file: path.join(dirname, 'problem' + postfix + '.md') }
1717
this.solution = { file: path.join(dirname, 'solution' + postfix + '.md') }
1818
this.solutionPath = path.resolve(__dirname, '..', 'solutions', problemName, 'index.js')
1919
this.troubleshootingPath = path.join(__dirname, '..', 'i18n', 'troubleshooting' + postfix + '.md')
2020
}
2121

2222
exports.verify = function (args, cb) {
23-
var attemptPath = path.resolve(process.cwd(), args[0])
23+
const attemptPath = path.resolve(process.cwd(), args[0])
2424
compare(this.solutionPath, attemptPath, i18n, function (_, match, obj) {
2525
if (match) {
2626
return cb(null, true)
@@ -31,7 +31,7 @@ module.exports = function createProblem (dirname) {
3131
return
3232
}
3333

34-
var message = getFile(this.troubleshootingPath)
34+
let message = getFile(this.troubleshootingPath)
3535

3636
message = message.replace(/%solution%/g, obj.solution)
3737
message = message.replace(/%attempt%/g, obj.attempt)

lib/run-solution.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
var fs = require('fs')
2-
var exec = require('child_process').exec
1+
const fs = require('fs')
2+
const exec = require('child_process').exec
33

44
/**
55
* @param {!string} filePath

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
"dependencies": {
1010
"colors": "^1.4.0",
1111
"diff": "^4.0.2",
12-
"workshopper-adventure": "^6.1.0"
12+
"workshopper-adventure": "^6.1.1"
1313
},
1414
"devDependencies": {
15-
"standard": "^14.3.3",
15+
"standard": "^16.0.3",
1616
"workshopper-adventure-test": "^1.2.0"
1717
},
1818
"engines": {

solutions/numbers/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
var example = 123456789
1+
const example = 123456789
22
console.log(example)

0 commit comments

Comments
 (0)