schat2-clive/assets/riddle-dedupe.js

20 lines
380 B
JavaScript

'use strict';
const riddles = require('./riddles.json');
function init() {
const answers = new Map();
riddles.forEach((riddle) => {
riddle.answers.forEach((answer) => {
if (answers.has(answer)) {
console.log(`Possible duplicate, answer '${answer}' for ${riddle.riddle} ||| ${answers.get(answer).riddle}`);
}
answers.set(answer, riddle);
});
});
}
init();