-const ProblemModel =
-{
- checkProblem: function(p)
- {
- if (!p.id.toString().match(/^[0-9]+$/))
- return "Wrong problem ID";
- if (!p.vid.toString().match(/^[0-9]+$/))
- return "Wrong variant ID";
- if (!p.fen.match(/^[a-zA-Z0-9, /-]*$/))
- return "Bad FEN string";
- return "";
+const ProblemModel = {
+ checkProblem: function(p) {
+ return (
+ p.id.toString().match(/^[0-9]+$/) &&
+ p.vid.toString().match(/^[0-9]+$/) &&
+ p.fen.match(/^[a-zA-Z0-9, /-]*$/)
+ );