import { INode , MaskInputFn , MaskInputOptions } from './types' ; export function isElement ( n ) { return n . nodeType === n . ELEMENT_NODE ; } export function isShadowRoot ( n ) { const host = ( n as ShadowRoot ) ?. host ; return Boolean ( host && host . shadowRoot && host . shadowRoot === n ) ; } export function maskInputValue ( { maskInputOptions , tagName , type , value , maskInputFn , } ) { let text = value || '' ; if ( maskInputOptions [ tagName . toLowerCase ( ) as keyof MaskInputOptions ] || maskInputOptions [ type as keyof MaskInputOptions ] ) { if ( maskInputFn ) { text = maskInputFn ( text ) ; } else { text = '*' . repeat ( text . length ) ; } } return text ; }