enum.jst (552B)
1 {{# def.definitions }} 2 {{# def.errors }} 3 {{# def.setupKeyword }} 4 {{# def.$data }} 5 6 {{ 7 var $i = 'i' + $lvl 8 , $vSchema = 'schema' + $lvl; 9 }} 10 11 {{? !$isData }} 12 var {{=$vSchema}} = validate.schema{{=$schemaPath}}; 13 {{?}} 14 var {{=$valid}}; 15 16 {{?$isData}}{{# def.check$dataIsArray }}{{?}} 17 18 {{=$valid}} = false; 19 20 for (var {{=$i}}=0; {{=$i}}<{{=$vSchema}}.length; {{=$i}}++) 21 if (equal({{=$data}}, {{=$vSchema}}[{{=$i}}])) { 22 {{=$valid}} = true; 23 break; 24 } 25 26 {{? $isData }} } {{?}} 27 28 {{# def.checkError:'enum' }} 29 30 {{? $breakOnError }} else { {{?}}