30 lines
626 B
JavaScript
30 lines
626 B
JavaScript
|
// Answers to questions
|
||
|
// --------------------
|
||
|
var data = {
|
||
|
'canaarohihavecoffee': {
|
||
|
'question': "Can Aarohi have coffee",
|
||
|
'logic': function () {
|
||
|
return (Date.now() > Date.parse('2020-05-24')) ? "yes" : "no";
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
|
||
|
// Exported functions
|
||
|
module.exports = {
|
||
|
riddle_me: function (q) {
|
||
|
|
||
|
var ret = {
|
||
|
"question": "Do I understand your query",
|
||
|
"answer": "no"
|
||
|
};
|
||
|
|
||
|
if (q in data) {
|
||
|
var scope = data[q];
|
||
|
ret.question = scope.question,
|
||
|
ret.answer = scope.logic()
|
||
|
}
|
||
|
|
||
|
return ret;
|
||
|
}
|
||
|
}
|