just-handlebars-helpers
just-handlebars-helpers copied to clipboard
Not actually a issue but request for adding another imp. maths helper function i.e Factorial of a Number
code:
const factorial=(num)=>{
if(num===0 || num===1){
return 1;
}
return num*factorial(num-1);
}
console.log(factorial(18)) //6402373705728000
.
@GunarajKhatri Sorry for the very late reply.
You can add this helper yourself here --> https://github.com/leapfrogtechnology/just-handlebars-helpers/blob/main/src/helpers/math.js and send a Pull Request.
Also, don't forget to add some tests here --> https://github.com/leapfrogtechnology/just-handlebars-helpers/blob/main/tests/helpers/math.spec.js
We can happily merge the PR if you send it over. Thank you. Unfortunately there are no active contributors in this repository that can help you right away.
@mesaugat How do we tackle decimal and negative numbers though?