lib/services/db.js
function defer() {
  const def = promiseDefer();

  def.apply = function (err, result) {
    if (err) {
      def.reject(err);
    } else {
      def.resolve(result);
    }
  };

  return def;
}
function defer() {
  const def = promiseDefer();

  def.apply = function (err, result) {
    if (err) {
      def.reject(err);
    } else {
      def.resolve(result);
    }
  };

  return def;
}
function defer ( ) { const def = promiseDefer ( ) ; def . apply = function ( err , result ) { if ( err ) { def . reject ( err ) ; } else { def . resolve ( result ) ; } } ; return def ; }
Use ES6 promises
@returns {{apply: function}}
Use ES6 promises