What is the purpose of cint

I am trying t understand erpnext code and on many places cint is used. What exactly is the purpose of cint?

1 Like

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;
}
1 Like

Thankyou

1 Like