jerrybendy / vue-touch-events

Support simple touch events (tap / swipe / touch hold)
MIT License
537 stars 51 forks source link

alternative methods to improve code readablity #55

Closed SreeChandan closed 4 years ago

SreeChandan commented 4 years ago

Hey, I hope I'm not offending. I was going through your code and felt like your usage of indexOf could be replaced with more explicit and appropriate methods like 'includes' and 'startsWith'. Let me know if you are actually using the index. It took me a while to understand you weren't using the index so thought to make it more explicit and use better alternatives.

jerrybendy commented 4 years ago

startsWith is a new feature of ES2015, so it doesn't have a good compatibility.

SreeChandan commented 4 years ago

Ah, I didn't think of that.

jerrybendy commented 4 years ago

That's ok. There is a polyfill in MDN

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith#Polyfill

But this could bring more code. And I want this library smaller.