mirror of
https://github.com/rust-lang/rustlings.git
synced 2026-01-10 20:59:19 +00:00
20 lines
451 B
JavaScript
20 lines
451 B
JavaScript
// TODO 判断文件是否存在
|
|
|
|
function judge(outputFile) {
|
|
try {
|
|
let jsonResult = JSON.parse(outputFile);
|
|
let points = {};
|
|
jsonResult.exercises.forEach(({ name, result }) => {
|
|
if (result) {
|
|
points[name] = [1,1]
|
|
} else {
|
|
points[name] = [0,1]
|
|
}
|
|
})
|
|
return points;
|
|
} catch(e) {
|
|
return {};
|
|
}
|
|
}
|
|
|
|
module.exports.judge = judge; |