var util = require('util');
var _ = require('lodash');
var Promise = require('bluebird');
var nodemailer = require('nodemailer');
var stubTransport = require('nodemailer-stub-transport');
var BaseMailer = require('./BaseMailer');

util.inherits(StubMailer, BaseMailer);

/**
 * Create mailer instance for stub sending
 * @constructor
 */
function StubMailer() {
  BaseMailer.apply(this, arguments);

  this.setTransporter(nodemailer.createTransport(stubTransport(this.get('transporter'))));
}

/**
 * Send message
 * @param {Object} [_config] Additional configuration for overriding default
 * @returns {Promise}
 */
StubMailer.prototype.send = function (_config) {
  var config = _.omit(_.merge({}, this.get(), _config), 'transporter');

  return new Promise(function (resolve, reject) {
    this.getTransporter().sendMail(config, function (error, result) {
      return error ? reject(error) : resolve(result);
    });
  }.bind(this));
};

module.exports = StubMailer;

@@ -1,56 +1,26 @@
-var util = require('util');%0Avar _ = require(
+import _ from 
 'lodash'
 );%0Av
@@ -19,49 +19,16 @@
 ash'
-)
 ;%0A
-var Promise = require('bluebird');%0Avar
+import
  nod
@@ -35,26 +35,21 @@
 emailer 
-= require(
+from 
 'nodemai
@@ -52,22 +52,24 @@
 emailer'
-)
 ;%0A
-var
+import
  stubTra
@@ -75,26 +75,21 @@
 ansport 
-= require(
+from 
 'nodemai
@@ -111,14 +111,16 @@
 ort'
-)
 ;%0A
-var
+import
  Bas
@@ -131,18 +131,13 @@
 ler 
-= require(
+from 
 './B
@@ -150,26 +150,32 @@
 ler'
-)
 ;%0A%0A
-util.inherits(
+export default class 
 Stub
@@ -180,17 +180,24 @@
 ubMailer
-,
+ extends
  BaseMai
@@ -203,151 +203,69 @@
 iler
-);%0A%0A/**%0A * Create mailer instance for stub sending%0A * @constructor%0A */%0Afunction StubMailer() %7B%0A  BaseMailer.apply(this, argument
+ %7B%0A  constructor(...args) %7B%0A    super(...arg
 s);%0A%0A  
+ 
+ 
 this.set
 Tran
@@ -260,25 +260,22 @@
 this.set
-Transport
+Provid
 er(nodem
@@ -320,25 +320,22 @@
 is.get('
-transport
+provid
 er'))));
@@ -339,15 +339,21 @@
 ));%0A
+  
 %7D%0A%0A
+  
 /**%0A
+  
  * S
@@ -361,15 +361,14 @@
 nd m
-essage%0A
+ail%0A  
  * @
@@ -435,17 +435,11 @@
 ding
- default%0A
+%0A  
  * @
@@ -460,49 +460,20 @@
 se%7D%0A
+  
  */%0A
-StubMailer.prototype.send = function 
+  send
 (_co
@@ -486,11 +486,13 @@
 %7B%0A  
-var
+  let
  con
@@ -543,24 +543,23 @@
 ), '
-transport
+provid
 er');%0A%0A
+  
   re
@@ -575,25 +575,16 @@
 Promise(
-function 
 (resolve
@@ -596,23 +596,28 @@
 ect)
+ =%3E
  %7B%0A    
+  
 this.get
 Tran
@@ -612,25 +612,22 @@
 this.get
-Transport
+Provid
 er().sen
@@ -643,17 +643,8 @@
 fig,
- function
  (er
@@ -660,22 +660,10 @@
 lt) 
-%7B%0A      return
+=%3E
  err
@@ -698,16 +698,17 @@
 (result)
+)
 ;%0A    %7D)
@@ -716,51 +716,7 @@
 %0A  %7D
-.bind(this));%0A%7D;%0A%0Amodule.exports = StubMailer;
+%0A%7D
 %0A

Rewrite StubMailer with ES6