-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtrack.js
More file actions
24 lines (20 loc) · 729 Bytes
/
Copy pathtrack.js
File metadata and controls
24 lines (20 loc) · 729 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// List information about a track
module.exports = function(configfile, targets){
let returner = [['Exercise', 'Difficulty', 'Core', 'Unlocked By', 'Unlocks', 'Topics']],
trackSlug = targets.shift(),
track = configfile.tracks[trackSlug],
formatCore = core => (core ? 'yes' : '');
for(let exercise of track.exercises){
if(exercise['deprecated']) continue;
returner.push([
exercise.slug,
exercise.difficulty,
formatCore(exercise.core),
exercise.unlocked_by || '',
track.exercises.filter(e => e.unlocked_by === exercise.slug).map(e => e.slug),
exercise.topics
]);
}
returner.sort((a, b) => a[1] - b[1]); // by difficulty ascending
return returner;
}