I am trying t understand erpnext code and on many places cint is used. What exactly is the purpose of cint?
Hi
function cint(v, def) {
if (v === true)
return 1;
if (v === false)
return 0;
v = v + '';
if (v !== "0") v = lstrip(v, ['0']);
v = parseInt(v);
if (isNaN(v)) v = def === undefined ? 0 : def;
return v;
}
Thankyou
1 Like