nl_tokens: / * function promisify ( fn ... args ) { return new Promise (( resolve reject ) = > { args = args . slice () ; args . push ( function ( err result ) { if ( err ) reject ( err ) ; else resolve ( result ) ; } ) ; try { fn . apply ( null args ) ; } catch ( ex ) { reject ( ex ) ; } } ) ; } module . exports . promisify = promisify ;
pl_tokens: function promisifyThis ( fn , self , ... args ) { return new Promise ( ( resolve , reject ) => { args = args . slice ( ) ; args . push ( function ( err , result ) { if ( err ) { reject ( err ) ; } else { resolve ( result ) ; } } ) ; try { fn . apply ( <mask> , args ) ; } catch ( ex ) { reject ( ex ) ; } } ) ; }