nadchif / html-duration-picker.js

Turn an HTML input box to a duration picker, without jQuery
https://nadchif.github.io/html-duration-picker.js/
Apache License 2.0
45 stars 62 forks source link

Optimisations #168

Open Epithermal opened 1 year ago

Epithermal commented 1 year ago

I removed the if statement for the case where selectionStart > minuteMarker and !hideSeconds, and moved the assignment of cursorSelection to 'seconds' to the else block. This is because the if statement is not needed - if hideSeconds is true, the function will not enter the else block. If hideSeconds is false, the function will enter the else block and cursorSelection will be assigned to 'seconds'.

I destructured the event parameter to avoid having to use event.target multiple times. This reduces the amount of code and may also improve readability.