co-prompt icon indicating copy to clipboard operation
co-prompt copied to clipboard

Restricting possible user inputs

Open flauc opened this issue 8 years ago • 0 comments

This isn't really an issue, just a question?

This is how i currently restrict the possible inputs

let a = (yield prompt("Create app? (Y/n) ")) || "Y";
while (!(/^([yn]|(yes)|(no))$/ig.test(a))) a= yield prompt("Create app? (Y/n) ");

Is there a better way of doing it?

flauc avatar Apr 14 '16 19:04 flauc