import addClass from 'dom-lib/addClass' ; import removeClass from 'dom-lib/removeClass' ; const toggleClass = ( node , className , condition ) => { if ( condition ) { addClass ( node , className ) ; } else { removeClass ( node , className ) ; } } ; export default ( node , className , condition ) => { if ( ! node ) { return ; } if ( Array . isArray ( node ) || Object . getPrototypeOf ( node ) . hasOwnProperty ( 'length' ) ) { node = node as HTMLElement [ ] ; Array . from ( node ) . forEach ( item => { toggleClass ( item , className , condition ) ; } ) ; return ; } toggleClass ( node , className , condition ) ; } ;