CyberChef/src/core/operations/Numberwang.js

30 lines
632 B
JavaScript
Raw Normal View History

2016-11-28 11:42:58 +01:00
/**
* Numberwang operations.
*
* @author Unknown Male 282
* @namespace
*/
const Numberwang = {
2016-11-28 11:42:58 +01:00
/**
* Numberwang operation. Remain indoors.
*
* @param {string} input
* @param {Object[]} args
* @returns {string}
*/
run: function(input, args) {
if (!input) return "Let's play Wangernumb!";
2017-04-13 19:08:50 +02:00
const match = input.match(/\d+/);
2016-11-28 11:42:58 +01:00
if (match) {
return match[0] + "! That's Numberwang!";
} else {
// That's a bad miss!
return "Sorry, that's not Numberwang. Let's rotate the board!";
}
},
2017-02-09 16:09:33 +01:00
2016-11-28 11:42:58 +01:00
};
export default Numberwang;