import each from 'lodash/each' ; import { IPlugin } from './@types/pawjs' ; export default abstract class AbstractPlugin { hooks : any ; constructor ( ) { this . addPlugin = this . addPlugin . bind ( this ) ; } addPlugin ( plugin ) { try { if ( plugin . hooks && Object . keys ( plugin . hooks ) . length ) { each ( plugin . hooks , ( hookValue , hookName ) => { this . hooks [ hookName ] = hookValue ; } ) ; } } catch ( ex ) { console . log ( ex ) ; } if ( plugin . apply ) { plugin . apply ( this ) ; } } }