import { ITag } from '../../typings/node' ; import { IStyleObj } from '../../typings/style' ; import { hasProp } from '../utils/has-prop' ; export const getAttr = ( node , key , defaultVal ) : string => { let val = defaultVal ; if ( node . hasAttribute ( key ) ) { val = node . getAttribute ( key ) as string ; } const styles = node . styles as IStyleObj ; if ( hasProp ( styles , key ) ) { val = styles [ key ] . value ; } return val ; } ;