Skip to content

Commit e189b34

Browse files
committed
fix quotes
1 parent ca57174 commit e189b34

21 files changed

Lines changed: 69 additions & 161 deletions

File tree

get-file.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
var fs = require('fs');
2+
var path = require('path');
3+
var md = require('cli-md');
4+
5+
module.exports = function (filepath) {
6+
return md(fs.readFileSync(filepath, 'utf8'))
7+
.replace(/'/g, "'")
8+
.replace(/"/g, '"');
9+
};

problems/array-filtering/index.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
1-
var fs = require('fs');
21
var path = require('path');
3-
var md = require('cli-md');
2+
var getFile = require('../../get-file');
43
var run = require('../../run-solution');
54

6-
exports.problem = md(
7-
fs.readFileSync(path.join(__dirname, 'problem.md'), 'utf8')
8-
);
5+
exports.problem = getFile(path.join(__dirname, 'problem.md'));
96

10-
exports.solution = md(
11-
fs.readFileSync(path.join(__dirname, 'solution.md'), 'utf8')
12-
);
7+
exports.solution = getFile(path.join(__dirname, 'solution.md'));
138

149
exports.verify = function (args, cb) {
1510
run(args[0], function (err, result) {

problems/arrays/index.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
1-
var fs = require('fs');
21
var path = require('path');
3-
var md = require('cli-md');
2+
var getFile = require('../../get-file');
43
var run = require('../../run-solution');
54

6-
exports.problem = md(
7-
fs.readFileSync(path.join(__dirname, 'problem.md'), 'utf8')
8-
);
5+
exports.problem = getFile(path.join(__dirname, 'problem.md'));
96

10-
exports.solution = md(
11-
fs.readFileSync(path.join(__dirname, 'solution.md'), 'utf8')
12-
);
7+
exports.solution = getFile(path.join(__dirname, 'solution.md'));
138

149
exports.verify = function (args, cb) {
1510
run(args[0], function (err, result) {

problems/for-loop/index.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
1-
var fs = require('fs');
21
var path = require('path');
3-
var md = require('cli-md');
2+
var getFile = require('../../get-file');
43
var run = require('../../run-solution');
54

6-
exports.problem = md(
7-
fs.readFileSync(path.join(__dirname, 'problem.md'), 'utf8')
8-
);
5+
exports.problem = getFile(path.join(__dirname, 'problem.md'));
96

10-
exports.solution = md(
11-
fs.readFileSync(path.join(__dirname, 'solution.md'), 'utf8')
12-
);
7+
exports.solution = getFile(path.join(__dirname, 'solution.md'));
138

149
exports.verify = function (args, cb) {
1510
run(args[0], function (err, result) {

problems/function-arguments/index.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
1-
var fs = require('fs');
21
var path = require('path');
3-
var md = require('cli-md');
2+
var getFile = require('../../get-file');
43
var run = require('../../run-solution');
54

6-
exports.problem = md(
7-
fs.readFileSync(path.join(__dirname, 'problem.md'), 'utf8')
8-
);
5+
exports.problem = getFile(path.join(__dirname, 'problem.md'));
96

10-
exports.solution = md(
11-
fs.readFileSync(path.join(__dirname, 'solution.md'), 'utf8')
12-
);
7+
exports.solution = getFile(path.join(__dirname, 'solution.md'));
138

149
exports.verify = function (args, cb) {
1510
run(args[0], function (err, result) {

problems/function-return-values/index.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
1-
var fs = require('fs');
21
var path = require('path');
3-
var md = require('cli-md');
2+
var getFile = require('../../get-file');
43
var run = require('../../run-solution');
54

6-
exports.problem = md(
7-
fs.readFileSync(path.join(__dirname, 'problem.md'), 'utf8')
8-
);
5+
exports.problem = getFile(path.join(__dirname, 'problem.md'));
96

10-
exports.solution = md(
11-
fs.readFileSync(path.join(__dirname, 'solution.md'), 'utf8')
12-
);
7+
exports.solution = getFile(path.join(__dirname, 'solution.md'));
138

149
exports.verify = function (args, cb) {
1510
run(args[0], function (err, result) {

problems/functions/index.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
1-
var fs = require('fs');
21
var path = require('path');
3-
var md = require('cli-md');
2+
var getFile = require('../../get-file');
43
var run = require('../../run-solution');
54

6-
exports.problem = md(
7-
fs.readFileSync(path.join(__dirname, 'problem.md'), 'utf8')
8-
);
5+
exports.problem = getFile(path.join(__dirname, 'problem.md'));
96

10-
exports.solution = md(
11-
fs.readFileSync(path.join(__dirname, 'solution.md'), 'utf8')
12-
);
7+
exports.solution = getFile(path.join(__dirname, 'solution.md'));
138

149
exports.verify = function (args, cb) {
1510
run(args[0], function (err, result) {

problems/introduction/index.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
1-
var fs = require('fs');
21
var path = require('path');
3-
var md = require('cli-md');
2+
var getFile = require('../../get-file');
43
var run = require('../../run-solution');
54

6-
exports.problem = md(
7-
fs.readFileSync(path.join(__dirname, 'problem.md')).toString()
8-
);
5+
exports.problem = getFile(path.join(__dirname, 'problem.md'));
96

10-
exports.solution = md(
11-
fs.readFileSync(path.join(__dirname, 'solution.md')).toString()
12-
);
7+
exports.solution = getFile(path.join(__dirname, 'solution.md'));
138

149
exports.verify = function (args, cb) {
1510
run(args[0], function (err, result) {

problems/looping-through-arrays/index.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
1-
var fs = require('fs');
21
var path = require('path');
3-
var md = require('cli-md');
2+
var getFile = require('../../get-file');
43
var run = require('../../run-solution');
54

6-
exports.problem = md(
7-
fs.readFileSync(path.join(__dirname, 'problem.md'), 'utf8')
8-
);
5+
exports.problem = getFile(path.join(__dirname, 'problem.md'));
96

10-
exports.solution = md(
11-
fs.readFileSync(path.join(__dirname, 'solution.md'), 'utf8')
12-
);
7+
exports.solution = getFile(path.join(__dirname, 'solution.md'));
138

149
exports.verify = function (args, cb) {
1510
run(args[0], function (err, result) {

problems/number-to-string/index.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
1-
var fs = require('fs');
21
var path = require('path');
3-
var md = require('cli-md');
2+
var getFile = require('../../get-file');
43
var run = require('../../run-solution');
54

6-
exports.problem = md(
7-
fs.readFileSync(path.join(__dirname, 'problem.md'), 'utf8')
8-
);
5+
exports.problem = getFile(path.join(__dirname, 'problem.md'));
96

10-
exports.solution = md(
11-
fs.readFileSync(path.join(__dirname, 'solution.md'), 'utf8')
12-
);
7+
exports.solution = getFile(path.join(__dirname, 'solution.md'));
138

149
exports.verify = function (args, cb) {
1510
run(args[0], function (err, result) {

0 commit comments

Comments
 (0)