JSFiddle - React, Tailwind, and code Playground
JavaScript
getNumber = function(match) {
var isDoubled = lookAhead(match),
size = (match === "@" ? 14 : (match === "!" ? 20 :
(match === "y" && isDoubled ? 4 : (match === "o" ? 3 : 2)))),
digits = new RegExp("^\\d{1," + size + "}"),
num = value.substring(iValue).match(digits);
if (!num) {
throw "Missing number at position " + iValue;
} else {
/*START: This fixes the bug for me*/
if (num[0].length < size && match === "y")
throw "Missing numbers at position " + iValue;
/*END*/
}
console.log(num);
iValue += num[0].length;
return parseInt(num[0], 10);
},