multipleOf.jst (618B)
1 {{# def.definitions }} 2 {{# def.errors }} 3 {{# def.setupKeyword }} 4 {{# def.$data }} 5 6 var division{{=$lvl}}; 7 if ({{?$isData}} 8 {{=$schemaValue}} !== undefined && ( 9 typeof {{=$schemaValue}} != 'number' || 10 {{?}} 11 (division{{=$lvl}} = {{=$data}} / {{=$schemaValue}}, 12 {{? it.opts.multipleOfPrecision }} 13 Math.abs(Math.round(division{{=$lvl}}) - division{{=$lvl}}) > 1e-{{=it.opts.multipleOfPrecision}} 14 {{??}} 15 division{{=$lvl}} !== parseInt(division{{=$lvl}}) 16 {{?}} 17 ) 18 {{?$isData}} ) {{?}} ) { 19 {{# def.error:'multipleOf' }} 20 } {{? $breakOnError }} else { {{?}}