New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

javascripting

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

javascripting - npm Package Compare versions

Comparing version 1.9.1 to 1.10.0

compare-solution.js

6

package.json
{
"name": "javascripting",
"description": "Learn JavaScript by adventuring around in the terminal.",
"version": "1.9.1",
"version": "1.10.0",
"repository": {

@@ -15,4 +15,6 @@ "url": "git://github.com/sethvincent/javascripting.git"

"adventure": "^2.8.0",
"cli-md": "^0.1.0"
"cli-md": "^0.1.0",
"colors": "^1.0.3",
"diff": "^1.2.1"
}
}
var path = require('path');
var getFile = require('../../get-file');
var run = require('../../run-solution');
var compare = require('../../compare-solution');
exports.problem = getFile(path.join(__dirname, 'problem.md'));
var problemName = __dirname.split('/');
problemName = problemName[problemName.length-1];
exports.problem = getFile(path.join(__dirname, 'problem.md'));
exports.solution = getFile(path.join(__dirname, 'solution.md'));
exports.fail = getFile(path.join(__dirname, 'troubleshooting.md'));
var solutionPath = path.resolve(__dirname, "../../solutions", problemName, "index.js");
var troubleshootingPath = path.resolve(__dirname, "../../troubleshooting.md");
exports.verify = function (args, cb) {
run(args[0], function (err, result) {
var expected = "[ 2, 4, 6, 8, 10 ]\n";
if (result === expected) cb(true);
else cb(false);
var attemptPath = path.resolve(process.cwd(), args[0]);
compare(solutionPath, attemptPath, function(match, obj) {
if(match) {
return cb(true);
}
if(!obj) {
// An error occured, we've already printed an error
return;
}
var message = getFile(troubleshootingPath);
message = message.replace(/%solution%/g, obj.solution);
message = message.replace(/%attempt%/g, obj.attempt);
message = message.replace(/%diff%/g, obj.diff);
message = message.replace(/%filename%/g, args[0]);
exports.fail = message;
cb(false);
});

@@ -17,0 +40,0 @@ };

var path = require('path');
var getFile = require('../../get-file');
var run = require('../../run-solution');
var compare = require('../../compare-solution');
exports.problem = getFile(path.join(__dirname, 'problem.md'));
var problemName = __dirname.split('/');
problemName = problemName[problemName.length-1];
exports.problem = getFile(path.join(__dirname, 'problem.md'));
exports.solution = getFile(path.join(__dirname, 'solution.md'));
exports.fail = getFile(path.join(__dirname, 'troubleshooting.md'));
var solutionPath = path.resolve(__dirname, "../../solutions", problemName, "index.js");
var troubleshootingPath = path.resolve(__dirname, "../../troubleshooting.md");
exports.verify = function (args, cb) {
run(args[0], function (err, result) {
var expected = "[ 'tomato sauce', 'cheese', 'pepperoni' ]\n";
if (result && result.replace('"', "'") === expected) cb(true);
else cb(false);
var attemptPath = path.resolve(process.cwd(), args[0]);
compare(solutionPath, attemptPath, function(match, obj) {
if(match) {
return cb(true);
}
if(!obj) {
// An error occured, we've already printed an error
return;
}
var message = getFile(troubleshootingPath);
message = message.replace(/%solution%/g, obj.solution);
message = message.replace(/%attempt%/g, obj.attempt);
message = message.replace(/%diff%/g, obj.diff);
message = message.replace(/%filename%/g, args[0]);
exports.fail = message;
cb(false);
});

@@ -17,0 +40,0 @@ };

var path = require('path');
var getFile = require('../../get-file');
var run = require('../../run-solution');
var compare = require('../../compare-solution');
exports.problem = getFile(path.join(__dirname, 'problem.md'));
var problemName = __dirname.split('/');
problemName = problemName[problemName.length-1];
exports.problem = getFile(path.join(__dirname, 'problem.md'));
exports.solution = getFile(path.join(__dirname, 'solution.md'));
exports.fail = getFile(path.join(__dirname, 'troubleshooting.md'));
var solutionPath = path.resolve(__dirname, "../../solutions", problemName, "index.js");
var troubleshootingPath = path.resolve(__dirname, "../../troubleshooting.md");
exports.verify = function (args, cb) {
run(args[0], function (err, result) {
if (/^45\n$/.test(result)) cb(true);
else cb(false);
var attemptPath = path.resolve(process.cwd(), args[0]);
compare(solutionPath, attemptPath, function(match, obj) {
if(match) {
return cb(true);
}
if(!obj) {
// An error occured, we've already printed an error
return;
}
var message = getFile(troubleshootingPath);
message = message.replace(/%solution%/g, obj.solution);
message = message.replace(/%attempt%/g, obj.attempt);
message = message.replace(/%diff%/g, obj.diff);
message = message.replace(/%filename%/g, args[0]);
exports.fail = message;
cb(false);
});

@@ -16,0 +40,0 @@ };

var path = require('path');
var getFile = require('../../get-file');
var run = require('../../run-solution');
var compare = require('../../compare-solution');
exports.problem = getFile(path.join(__dirname, 'problem.md'));
var problemName = __dirname.split('/');
problemName = problemName[problemName.length-1];
exports.problem = getFile(path.join(__dirname, 'problem.md'));
exports.solution = getFile(path.join(__dirname, 'solution.md'));
exports.fail = getFile(path.join(__dirname, 'troubleshooting.md'));
var solutionPath = path.resolve(__dirname, "../../solutions", problemName, "index.js");
var troubleshootingPath = path.resolve(__dirname, "../../troubleshooting.md");
exports.verify = function (args, cb) {
run(args[0], function (err, result) {
if (/^4140\n$/.test(result)) cb(true);
else cb(false);
var attemptPath = path.resolve(process.cwd(), args[0]);
compare(solutionPath, attemptPath, function(match, obj) {
if(match) {
return cb(true);
}
if(!obj) {
// An error occured, we've already printed an error
return;
}
var message = getFile(troubleshootingPath);
message = message.replace(/%solution%/g, obj.solution);
message = message.replace(/%attempt%/g, obj.attempt);
message = message.replace(/%diff%/g, obj.diff);
message = message.replace(/%filename%/g, args[0]);
exports.fail = message;
cb(false);
});

@@ -16,0 +40,0 @@ };

var path = require('path');
var getFile = require('../../get-file');
var run = require('../../run-solution');
var compare = require('../../compare-solution');
exports.problem = getFile(path.join(__dirname, 'problem.md'));
var problemName = __dirname.split('/');
problemName = problemName[problemName.length-1];
exports.problem = getFile(path.join(__dirname, 'problem.md'));
exports.solution = getFile(path.join(__dirname, 'solution.md'));
exports.fail = getFile(path.join(__dirname, 'troubleshooting.md'));
var solutionPath = path.resolve(__dirname, "../../solutions", problemName, "index.js");
var troubleshootingPath = path.resolve(__dirname, "../../troubleshooting.md");
exports.verify = function (args, cb) {
run(args[0], function (err, result) {
if (/hello/.test(result)) cb(true);
else cb(false);
var attemptPath = path.resolve(process.cwd(), args[0]);
compare(solutionPath, attemptPath, function(match, obj) {
if(match) {
return cb(true);
}
if(!obj) {
// An error occured, we've already printed an error
return;
}
var message = getFile(troubleshootingPath);
message = message.replace(/%solution%/g, obj.solution);
message = message.replace(/%attempt%/g, obj.attempt);
message = message.replace(/%diff%/g, obj.diff);
message = message.replace(/%filename%/g, args[0]);
exports.fail = message;
cb(false);
});

@@ -16,0 +40,0 @@ };

var path = require('path');
var getFile = require('../../get-file');
var run = require('../../run-solution');
var compare = require('../../compare-solution');
exports.problem = getFile(path.join(__dirname, 'problem.md'));
var problemName = __dirname.split('/');
problemName = problemName[problemName.length-1];
exports.problem = getFile(path.join(__dirname, 'problem.md'));
exports.solution = getFile(path.join(__dirname, 'solution.md'));
exports.fail = getFile(path.join(__dirname, 'troubleshooting.md'));
var solutionPath = path.resolve(__dirname, "../../solutions", problemName, "index.js");
var troubleshootingPath = path.resolve(__dirname, "../../troubleshooting.md");
exports.verify = function (args, cb) {
run(args[0], function (err, result) {
if (/^bananas tasted really good.\n$/.test(result)) cb(true);
else cb(false);
var attemptPath = path.resolve(process.cwd(), args[0]);
compare(solutionPath, attemptPath, function(match, obj) {
if(match) {
return cb(true);
}
if(!obj) {
// An error occured, we've already printed an error
return;
}
var message = getFile(troubleshootingPath);
message = message.replace(/%solution%/g, obj.solution);
message = message.replace(/%attempt%/g, obj.attempt);
message = message.replace(/%diff%/g, obj.diff);
message = message.replace(/%filename%/g, args[0]);
exports.fail = message;
cb(false);
});

@@ -16,0 +40,0 @@ };

var path = require('path');
var getFile = require('../../get-file');
var run = require('../../run-solution');
var compare = require('../../compare-solution');
exports.problem = getFile(path.join(__dirname, 'problem.md'));
var problemName = __dirname.split('/');
problemName = problemName[problemName.length-1];
exports.problem = getFile(path.join(__dirname, 'problem.md'));
exports.solution = getFile(path.join(__dirname, 'solution.md'));
exports.fail = getFile(path.join(__dirname, 'troubleshooting.md'));
var solutionPath = path.resolve(__dirname, "../../solutions", problemName, "index.js");
var troubleshootingPath = path.resolve(__dirname, "../../troubleshooting.md");
exports.verify = function (args, cb) {
run(args[0], function (err, result) {
if (/^The fruit name has more than five characters.\n$/.test(result)) cb(true);
else cb(false);
var attemptPath = path.resolve(process.cwd(), args[0]);
compare(solutionPath, attemptPath, function(match, obj) {
if(match) {
return cb(true);
}
if(!obj) {
// An error occured, we've already printed an error
return;
}
var message = getFile(troubleshootingPath);
message = message.replace(/%solution%/g, obj.solution);
message = message.replace(/%attempt%/g, obj.attempt);
message = message.replace(/%diff%/g, obj.diff);
message = message.replace(/%filename%/g, args[0]);
exports.fail = message;
cb(false);
});

@@ -16,0 +40,0 @@ };

@@ -27,6 +27,6 @@ ---

Make the `fruit` variable reference the value **orange**.
Make the `fruit` variable reference the value **orange** with the type of **String**.
Then use `console.log()` to print **The fruit name has more than five characters.** if the length of the value of `fruit` is greater than five.
Print **The fruit name has five characters or less.** otherwise.
Then use `console.log()` to print "**The fruit name has more than five characters."** if the length of the value of `fruit` is greater than five.
Otherwise, print "**The fruit name has five characters or less.**"

@@ -33,0 +33,0 @@ Check to see if your program is correct by running this command:

var path = require('path');
var getFile = require('../../get-file');
var run = require('../../run-solution');
var compare = require('../../compare-solution');
exports.problem = getFile(path.join(__dirname, 'problem.md'));
var problemName = __dirname.split('/');
problemName = problemName[problemName.length-1];
exports.problem = getFile(path.join(__dirname, 'problem.md'));
exports.solution = getFile(path.join(__dirname, 'solution.md'));
exports.fail = getFile(path.join(__dirname, 'troubleshooting.md'));
var solutionPath = path.resolve(__dirname, "../../solutions", problemName, "index.js");
var troubleshootingPath = path.resolve(__dirname, "../../troubleshooting.md");
exports.verify = function (args, cb) {
run(args[0], function (err, result) {
if (/^hello\n$/.test(result)) cb(true);
else cb(false);
var attemptPath = path.resolve(process.cwd(), args[0]);
compare(solutionPath, attemptPath, function(match, obj) {
if(match) {
return cb(true);
}
if(!obj) {
// An error occured, we've already printed an error
return;
}
var message = getFile(troubleshootingPath);
message = message.replace(/%solution%/g, obj.solution);
message = message.replace(/%attempt%/g, obj.attempt);
message = message.replace(/%diff%/g, obj.diff);
message = message.replace(/%filename%/g, args[0]);
exports.fail = message;
cb(false);
});

@@ -16,0 +40,0 @@ };

var path = require('path');
var getFile = require('../../get-file');
var run = require('../../run-solution');
var compare = require('../../compare-solution');
exports.problem = getFile(path.join(__dirname, 'problem.md'));
var problemName = __dirname.split('/');
problemName = problemName[problemName.length-1];
exports.problem = getFile(path.join(__dirname, 'problem.md'));
exports.solution = getFile(path.join(__dirname, 'solution.md'));
exports.fail = getFile(path.join(__dirname, 'troubleshooting.md'));
var solutionPath = path.resolve(__dirname, "../../solutions", problemName, "index.js");
var troubleshootingPath = path.resolve(__dirname, "../../troubleshooting.md");
exports.verify = function (args, cb) {
run(args[0], function (err, result) {
var expected = "[ 'cats', 'dogs', 'rats' ]\n";
if (result === expected) cb(true);
else cb(false);
var attemptPath = path.resolve(process.cwd(), args[0]);
compare(solutionPath, attemptPath, function(match, obj) {
if(match) {
return cb(true);
}
if(!obj) {
// An error occured, we've already printed an error
return;
}
var message = getFile(troubleshootingPath);
message = message.replace(/%solution%/g, obj.solution);
message = message.replace(/%attempt%/g, obj.attempt);
message = message.replace(/%diff%/g, obj.diff);
message = message.replace(/%filename%/g, args[0]);
exports.fail = message;
cb(false);
});

@@ -17,0 +40,0 @@ };

var path = require('path');
var getFile = require('../../get-file');
var run = require('../../run-solution');
var compare = require('../../compare-solution');
exports.problem = getFile(path.join(__dirname, 'problem.md'));
var problemName = __dirname.split('/');
problemName = problemName[problemName.length-1];
exports.problem = getFile(path.join(__dirname, 'problem.md'));
exports.solution = getFile(path.join(__dirname, 'solution.md'));
exports.fail = getFile(path.join(__dirname, 'troubleshooting.md'));
var solutionPath = path.resolve(__dirname, "../../solutions", problemName, "index.js");
var troubleshootingPath = path.resolve(__dirname, "../../troubleshooting.md");
exports.verify = function (args, cb) {
run(args[0], function (err, result) {
if (/^128\n$/.test(result)) cb(true);
else cb(false);
var attemptPath = path.resolve(process.cwd(), args[0]);
compare(solutionPath, attemptPath, function(match, obj) {
if(match) {
return cb(true);
}
if(!obj) {
// An error occured, we've already printed an error
return;
}
var message = getFile(troubleshootingPath);
message = message.replace(/%solution%/g, obj.solution);
message = message.replace(/%attempt%/g, obj.attempt);
message = message.replace(/%diff%/g, obj.diff);
message = message.replace(/%filename%/g, args[0]);
exports.fail = message;
cb(false);
});

@@ -16,0 +40,0 @@ };

var path = require('path');
var getFile = require('../../get-file');
var run = require('../../run-solution');
var compare = require('../../compare-solution');
exports.problem = getFile(path.join(__dirname, 'problem.md'));
var problemName = __dirname.split('/');
problemName = problemName[problemName.length-1];
exports.problem = getFile(path.join(__dirname, 'problem.md'));
exports.solution = getFile(path.join(__dirname, 'solution.md'));
exports.fail = getFile(path.join(__dirname, 'troubleshooting.md'));
var solutionPath = path.resolve(__dirname, "../../solutions", problemName, "index.js");
var troubleshootingPath = path.resolve(__dirname, "../../troubleshooting.md");
exports.verify = function (args, cb) {
run(args[0], function (err, result) {
if (/^123456789\n$/.test(result)) cb(true);
else cb(false);
var attemptPath = path.resolve(process.cwd(), args[0]);
compare(solutionPath, attemptPath, function(match, obj) {
if(match) {
return cb(true);
}
if(!obj) {
// An error occured, we've already printed an error
return;
}
var message = getFile(troubleshootingPath);
message = message.replace(/%solution%/g, obj.solution);
message = message.replace(/%attempt%/g, obj.attempt);
message = message.replace(/%diff%/g, obj.diff);
message = message.replace(/%filename%/g, args[0]);
exports.fail = message;
cb(false);
});

@@ -16,0 +40,0 @@ };

var path = require('path');
var getFile = require('../../get-file');
var run = require('../../run-solution');
var compare = require('../../compare-solution');
exports.problem = getFile(path.join(__dirname, 'problem.md'));
var problemName = __dirname.split('/');
problemName = problemName[problemName.length-1];
exports.problem = getFile(path.join(__dirname, 'problem.md'));
exports.solution = getFile(path.join(__dirname, 'solution.md'));
exports.fail = getFile(path.join(__dirname, 'troubleshooting.md'));
var solutionPath = path.resolve(__dirname, "../../solutions", problemName, "index.js");
var troubleshootingPath = path.resolve(__dirname, "../../troubleshooting.md");
exports.verify = function (args, cb) {
run(args[0], function (err, result) {
if (/hello/.test(result)) cb(true);
else cb(false);
var attemptPath = path.resolve(process.cwd(), args[0]);
compare(solutionPath, attemptPath, function(match, obj) {
if(match) {
return cb(true);
}
if(!obj) {
// An error occured, we've already printed an error
return;
}
var message = getFile(troubleshootingPath);
message = message.replace(/%solution%/g, obj.solution);
message = message.replace(/%attempt%/g, obj.attempt);
message = message.replace(/%diff%/g, obj.diff);
message = message.replace(/%filename%/g, args[0]);
exports.fail = message;
cb(false);
});

@@ -16,0 +40,0 @@ };

var path = require('path');
var getFile = require('../../get-file');
var run = require('../../run-solution');
var compare = require('../../compare-solution');
exports.problem = getFile(path.join(__dirname, 'problem.md'));
var problemName = __dirname.split('/');
problemName = problemName[problemName.length-1];
exports.problem = getFile(path.join(__dirname, 'problem.md'));
exports.solution = getFile(path.join(__dirname, 'solution.md'));
exports.fail = getFile(path.join(__dirname, 'troubleshooting.md'));
var solutionPath = path.resolve(__dirname, "../../solutions", problemName, "index.js");
var troubleshootingPath = path.resolve(__dirname, "../../troubleshooting.md");
exports.verify = function (args, cb) {
run(args[0], function (err, result) {
if (/only pizza/.test(result)) cb(true);
else cb(false);
var attemptPath = path.resolve(process.cwd(), args[0]);
compare(solutionPath, attemptPath, function(match, obj) {
if(match) {
return cb(true);
}
if(!obj) {
// An error occured, we've already printed an error
return;
}
var message = getFile(troubleshootingPath);
message = message.replace(/%solution%/g, obj.solution);
message = message.replace(/%attempt%/g, obj.attempt);
message = message.replace(/%diff%/g, obj.diff);
message = message.replace(/%filename%/g, args[0]);
exports.fail = message;
cb(false);
});

@@ -16,0 +40,0 @@ };

var path = require('path');
var getFile = require('../../get-file');
var run = require('../../run-solution');
var compare = require('../../compare-solution');
exports.problem = getFile(path.join(__dirname, 'problem.md'));
var problemName = __dirname.split('/');
problemName = problemName[problemName.length-1];
exports.problem = getFile(path.join(__dirname, 'problem.md'));
exports.solution = getFile(path.join(__dirname, 'solution.md'));
exports.fail = getFile(path.join(__dirname, 'troubleshooting.md'));
var solutionPath = path.resolve(__dirname, "../../solutions", problemName, "index.js");
var troubleshootingPath = path.resolve(__dirname, "../../troubleshooting.md");
var expected = "{ toppings: [ 'cheese', 'sauce', 'pepperoni' ],\n"
+ " crust: 'deep dish',\n"
+ " serves: 2 }\n";
exports.verify = function (args, cb) {
exports.verify = function (args, cb) {
run(args[0], function (err, result) {
if (result === expected) cb(true);
else cb(false);
var attemptPath = path.resolve(process.cwd(), args[0]);
compare(solutionPath, attemptPath, function(match, obj) {
if(match) {
return cb(true);
}
if(!obj) {
// An error occured, we've already printed an error
return;
}
var message = getFile(troubleshootingPath);
message = message.replace(/%solution%/g, obj.solution);
message = message.replace(/%attempt%/g, obj.attempt);
message = message.replace(/%diff%/g, obj.diff);
message = message.replace(/%filename%/g, args[0]);
exports.fail = message;
cb(false);
});

@@ -20,0 +40,0 @@ };

var path = require('path');
var getFile = require('../../get-file');
var run = require('../../run-solution');
var compare = require('../../compare-solution');
exports.problem = getFile(path.join(__dirname, 'problem.md'));
var problemName = __dirname.split('/');
problemName = problemName[problemName.length-1];
exports.problem = getFile(path.join(__dirname, 'problem.md'));
exports.solution = getFile(path.join(__dirname, 'solution.md'));
exports.fail = getFile(path.join(__dirname, 'troubleshooting.md'));
var solutionPath = path.resolve(__dirname, "../../solutions", problemName, "index.js");
var troubleshootingPath = path.resolve(__dirname, "../../troubleshooting.md");
exports.verify = function (args, cb) {
run(args[0], function (err, result) {
if (/^pizza is wonderful\n$/.test(result)) cb(true);
else cb(false);
var attemptPath = path.resolve(process.cwd(), args[0]);
compare(solutionPath, attemptPath, function(match, obj) {
if(match) {
return cb(true);
}
if(!obj) {
// An error occured, we've already printed an error
return;
}
var message = getFile(troubleshootingPath);
message = message.replace(/%solution%/g, obj.solution);
message = message.replace(/%attempt%/g, obj.attempt);
message = message.replace(/%diff%/g, obj.diff);
message = message.replace(/%filename%/g, args[0]);
exports.fail = message;
cb(false);
});

@@ -16,0 +40,0 @@ };

var path = require('path');
var getFile = require('../../get-file');
var run = require('../../run-solution');
var compare = require('../../compare-solution');
exports.problem = getFile(path.join(__dirname, 'problem.md'));
var problemName = __dirname.split('/');
problemName = problemName[problemName.length-1];
exports.problem = getFile(path.join(__dirname, 'problem.md'));
exports.solution = getFile(path.join(__dirname, 'solution.md'));
exports.fail = getFile(path.join(__dirname, 'troubleshooting.md'));
var solutionPath = path.resolve(__dirname, "../../solutions", problemName, "index.js");
var troubleshootingPath = path.resolve(__dirname, "../../troubleshooting.md");
exports.verify = function (args, cb) {
run(args[0], function (err, result) {
if (/2/.test(result)) cb(true);
else cb(false);
var attemptPath = path.resolve(process.cwd(), args[0]);
compare(solutionPath, attemptPath, function(match, obj) {
if(match) {
return cb(true);
}
if(!obj) {
// An error occured, we've already printed an error
return;
}
var message = getFile(troubleshootingPath);
message = message.replace(/%solution%/g, obj.solution);
message = message.replace(/%attempt%/g, obj.attempt);
message = message.replace(/%diff%/g, obj.diff);
message = message.replace(/%filename%/g, args[0]);
exports.fail = message;
cb(false);
});

@@ -16,0 +40,0 @@ };

var path = require('path');
var getFile = require('../../get-file');
var run = require('../../run-solution');
var compare = require('../../compare-solution');
exports.problem = getFile(path.join(__dirname, 'problem.md'));
var problemName = __dirname.split('/');
problemName = problemName[problemName.length-1];
exports.problem = getFile(path.join(__dirname, 'problem.md'));
exports.solution = getFile(path.join(__dirname, 'solution.md'));
exports.fail = getFile(path.join(__dirname, 'troubleshooting.md'));
var solutionPath = path.resolve(__dirname, "../../solutions", problemName, "index.js");
var troubleshootingPath = path.resolve(__dirname, "../../troubleshooting.md");
exports.verify = function (args, cb) {
run(args[0], function (err, result) {
if (/hello/.test(result)) cb(true);
else cb(false);
var attemptPath = path.resolve(process.cwd(), args[0]);
compare(solutionPath, attemptPath, function(match, obj) {
if(match) {
return cb(true);
}
if(!obj) {
// An error occured, we've already printed an error
return;
}
var message = getFile(troubleshootingPath);
message = message.replace(/%solution%/g, obj.solution);
message = message.replace(/%attempt%/g, obj.attempt);
message = message.replace(/%diff%/g, obj.diff);
message = message.replace(/%filename%/g, args[0]);
exports.fail = message;
cb(false);
});

@@ -16,0 +40,0 @@ };

var path = require('path');
var getFile = require('../../get-file');
var run = require('../../run-solution');
var compare = require('../../compare-solution');
exports.problem = getFile(path.join(__dirname, 'problem.md'));
var problemName = __dirname.split('/');
problemName = problemName[problemName.length-1];
exports.problem = getFile(path.join(__dirname, 'problem.md'));
exports.solution = getFile(path.join(__dirname, 'solution.md'));
exports.fail = getFile(path.join(__dirname, 'troubleshooting.md'));
var solutionPath = path.resolve(__dirname, "../../solutions", problemName, "index.js");
var troubleshootingPath = path.resolve(__dirname, "../../troubleshooting.md");
exports.verify = function (args, cb) {
run(args[0], function (err, result) {
if (result == 14) cb(true);
else cb(false);
var attemptPath = path.resolve(process.cwd(), args[0]);
compare(solutionPath, attemptPath, function(match, obj) {
if(match) {
return cb(true);
}
if(!obj) {
// An error occured, we've already printed an error
return;
}
var message = getFile(troubleshootingPath);
message = message.replace(/%solution%/g, obj.solution);
message = message.replace(/%attempt%/g, obj.attempt);
message = message.replace(/%diff%/g, obj.diff);
message = message.replace(/%filename%/g, args[0]);
exports.fail = message;
cb(false);
});

@@ -16,0 +40,0 @@ };

@@ -7,3 +7,3 @@ ---

For this you will use thing `.length` property. Here's an example:
For this you will use the `.length` property. Here's an example:

@@ -23,3 +23,3 @@ ```js

**Make the `example` variable reference the string `example string`.**
**Assign the string `'example string'` to the variable `example`.**

@@ -26,0 +26,0 @@ Use `console.log` to print the **length** of the string to the terminal.

var path = require('path');
var getFile = require('../../get-file');
var run = require('../../run-solution');
var compare = require('../../compare-solution');
exports.problem = getFile(path.join(__dirname, 'problem.md'));
var problemName = __dirname.split('/');
problemName = problemName[problemName.length-1];
exports.problem = getFile(path.join(__dirname, 'problem.md'));
exports.solution = getFile(path.join(__dirname, 'solution.md'));
exports.fail = getFile(path.join(__dirname, 'troubleshooting.md'));
var solutionPath = path.resolve(__dirname, "../../solutions", problemName, "index.js");
var troubleshootingPath = path.resolve(__dirname, "../../troubleshooting.md");
exports.verify = function (args, cb) {
run(args[0], function (err, result) {
if (/^this is a string\n$/.test(result)) cb(true);
else cb(false);
var attemptPath = path.resolve(process.cwd(), args[0]);
compare(solutionPath, attemptPath, function(match, obj) {
if(match) {
return cb(true);
}
if(!obj) {
// An error occured, we've already printed an error
return;
}
var message = getFile(troubleshootingPath);
message = message.replace(/%solution%/g, obj.solution);
message = message.replace(/%attempt%/g, obj.attempt);
message = message.replace(/%diff%/g, obj.diff);
message = message.replace(/%filename%/g, args[0]);
exports.fail = message;
cb(false);
});

@@ -20,2 +44,2 @@ };

require(path.resolve(process.cwd(), args[0]));
};
};
var path = require('path');
var getFile = require('../../get-file');
var run = require('../../run-solution');
var compare = require('../../compare-solution');
exports.problem = getFile(path.join(__dirname, 'problem.md'));
var problemName = __dirname.split('/');
problemName = problemName[problemName.length-1];
exports.problem = getFile(path.join(__dirname, 'problem.md'));
exports.solution = getFile(path.join(__dirname, 'solution.md'));
exports.fail = getFile(path.join(__dirname, 'troubleshooting.md'));
var solutionPath = path.resolve(__dirname, "../../solutions", problemName, "index.js");
var troubleshootingPath = path.resolve(__dirname, "../../troubleshooting.md");
exports.verify = function (args, cb) {
run(args[0], function (err, result) {
if (/hello/.test(result)) cb(true);
else cb(false);
var attemptPath = path.resolve(process.cwd(), args[0]);
compare(solutionPath, attemptPath, function(match, obj) {
if(match) {
return cb(true);
}
if(!obj) {
// An error occured, we've already printed an error
return;
}
var message = getFile(troubleshootingPath);
message = message.replace(/%solution%/g, obj.solution);
message = message.replace(/%attempt%/g, obj.attempt);
message = message.replace(/%diff%/g, obj.diff);
message = message.replace(/%filename%/g, args[0]);
exports.fail = message;
cb(false);
});

@@ -16,0 +40,0 @@ };

var path = require('path');
var getFile = require('../../get-file');
var run = require('../../run-solution');
var compare = require('../../compare-solution');
exports.problem = getFile(path.join(__dirname, 'problem.md'));
var problemName = __dirname.split('/');
problemName = problemName[problemName.length-1];
exports.problem = getFile(path.join(__dirname, 'problem.md'));
exports.solution = getFile(path.join(__dirname, 'solution.md'));
exports.fail = getFile(path.join(__dirname, 'troubleshooting.md'));
var solutionPath = path.resolve(__dirname, "../../solutions", problemName, "index.js");
var troubleshootingPath = path.resolve(__dirname, "../../troubleshooting.md");
exports.verify = function (args, cb) {
run(args[0], function (err, result) {
if (/^some string\n$/.test(result)) cb(true);
else cb(false);
var attemptPath = path.resolve(process.cwd(), args[0]);
compare(solutionPath, attemptPath, function(match, obj) {
if(match) {
return cb(true);
}
if(!obj) {
// An error occured, we've already printed an error
return;
}
var message = getFile(troubleshootingPath);
message = message.replace(/%solution%/g, obj.solution);
message = message.replace(/%attempt%/g, obj.attempt);
message = message.replace(/%diff%/g, obj.diff);
message = message.replace(/%filename%/g, args[0]);
exports.fail = message;
cb(false);
});

@@ -16,0 +40,0 @@ };

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc