export const inherits = ( ctor , superCtor ) => { if ( superCtor ) { ctor . super_ = superCtor ; ctor . prototype = Object . create ( superCtor . prototype , { constructor : { value : ctor , enumerable : false , writable : true , configurable : true , } , } ) ; } } ; export const inspect = ( ... args ) => args . forEach ( ( arg ) => console . log ( arg ) ) ; export const promisify = ( fn ) : ( ( ) => Promise < any > ) => { if ( typeof ( fn as any ) [ promisify . custom ] === 'function' ) { return function ( ... args ) { return ( fn as any ) [ promisify . custom ] . apply ( this , args ) ; } ; } return function ( ... args ) { return new Promise ( ( resolve , reject ) => { args . push ( ( err , result ) => { if ( err != null ) { reject ( err ) ; } else { resolve ( result ) ; } } ) ; fn . apply ( this , args ) ; } ) ; } ; } ; promisify . custom = Symbol ( 'promisify.custom' ) ; export default { inherits , inspect , promisify , } ;