To me it looks like it comes from a mail related code and the functions was simply copy-pasted keeping the same name. This looks weird to me and confusing at some extend, as the purpose of the function is not intended just for mails but templating strings/substitute in templates. I think some developers trying to contribute can find that name confusing as well.
Proposal
Change from processMail to something more descriptive as processString or parseTemplate.
Further improvements to structure, even cut this function in two or more, can be done but that is out of the scope of this issue.
Problem
The most important function on the package is named in a confusing way, like this:
https://github.com/jalasem/templatestringparser/blob/29fec424a86ee72110c7f98629989b15df8e9251/index.js#L17
To me it looks like it comes from a mail related code and the functions was simply copy-pasted keeping the same name. This looks weird to me and confusing at some extend, as the purpose of the function is not intended just for mails but templating strings/substitute in templates. I think some developers trying to contribute can find that name confusing as well.
Proposal
Change from
processMail
to something more descriptive asprocessString
orparseTemplate
.Further improvements to structure, even cut this function in two or more, can be done but that is out of the scope of this issue.