finnfiddle / words-to-numbers

JS library to convert textual words to numbers with optional fuzzy text matching
MIT License
248 stars 57 forks source link

allow capitalized word numbers #15

Closed timmliu closed 5 years ago

timmliu commented 7 years ago

ex: "tacos One minute"

finnfiddle commented 7 years ago

Hi @timmliu - thanks for the PR - however I would have done it a bit differently. Adding more number words increases the time complexity a lot because we iterate over these words each time we convert a string to numbers. I would instead have normalized the input by using .toLowerCase() when testing the words. If you like you can have a crack at it - otherwise I can probably have a go at it on the weekend. And also please if youre making a new PR could you add relevant tests. Thanks