Open shivangipathak312 opened 2 years ago
I have a requirements to use "float" and perform some calculation. But When input is alphanumeric value it is throwing an error. So I want to put some check, like If value is numeric than only perform calculation.
Can anyone help me with this using nunjuck ?
You can add custom test
environment.addTest('float', (value) => Number.isInteger(value) && value % 1 !== 0);
And use it like
{% if value is float %}
I have a requirements to use "float" and perform some calculation. But When input is alphanumeric value it is throwing an error. So I want to put some check, like If value is numeric than only perform calculation.
Can anyone help me with this using nunjuck ?