beholdr / maska

Simple zero-dependency input mask for Alpine.js, Svelte, Vue.js and vanilla JS.

Home Page:https://beholdr.github.io/maska

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Additional check needed before using the `in` operator for CustomEvent.detail

jsvini opened this issue · comments

Describe the bug

Hi, the mask crashes when CustomEvent.detail is a number, the if bellow assumes that CustomEvent.detail is always null or an object, but since it's a CustomEvent, it can have anything in the detail property.

'masked' in e.detail

Need to check if CustomEvent.detail is an object|array before using the in operator, or it will crash when it's something else.

Steps to reproduce

Try to fill this input, it will crash the mask:

https://stackblitz.com/edit/js-maska-3tsemx?file=index.js

Thanks, fixed in v2.1.3