DrKain / scrape-youtube

A lightning fast package to scrape YouTube search results
MIT License
108 stars 30 forks source link

Converter for 9K to 9000 #43

Closed damankarora closed 3 years ago

damankarora commented 3 years ago

Hey there, i saw your issue listed for this project. I created a function that you can call for converting it. I've never worked with TypeScript and i couldn't figure out how to test this solution. But the function is working fine. You can place this function in a separate file maybe, and call it wherever you need it. I implemented in the parser.ts

Hope this helps.

Also, this works only with capitalized letters(K, M, B). If you get small alphabets in response from scraper, you can convert the string to uppercase or just replace the switch statement with if-else.

Happy coding :)

DrKain commented 3 years ago

For the most part it looks good to me, I'll tweak it slightly, run some testing then push into the main branch. Thank you for the help

This merge will close #41