Server IP : 150.95.80.236 / Your IP : 18.217.0.127 Web Server : Apache System : Linux host-150-95-80-236 3.10.0-1160.105.1.el7.x86_64 #1 SMP Thu Dec 7 15:39:45 UTC 2023 x86_64 User : social-telecare ( 10000) PHP Version : 7.4.33 Disable Function : opcache_get_status MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/vhosts/pcu.in.th/uat.pcu.in.th/demo15/src/plugins/formvalidation/dist/es6/validators/ |
Upload File : |
import t from"../utils/format";export default function e(){const e=(t,e)=>{const s=Math.pow(10,e);const a=t*s;let n;switch(true){case a===0:n=0;break;case a>0:n=1;break;case a<0:n=-1;break}const r=a%1===.5*n;return r?(Math.floor(a)+(n>0?1:0))/s:Math.round(a)/s};const s=(t,s)=>{if(s===0){return 1}const a=`${t}`.split(".");const n=`${s}`.split(".");const r=(a.length===1?0:a[1].length)+(n.length===1?0:n[1].length);return e(t-s*Math.floor(t/s),r)};return{validate(e){if(e.value===""){return{valid:true}}const a=parseFloat(e.value);if(isNaN(a)||!isFinite(a)){return{valid:false}}const n=Object.assign({},{baseValue:0,message:"",step:1},e.options);const r=s(a-n.baseValue,n.step);return{message:t(e.l10n?n.message||e.l10n.step.default:n.message,`${n.step}`),valid:r===0||r===n.step}}}}