lib/wrapper.js
function _checkConnection(conn) {
  // Return Promise for getConnection callback wrapping
  return new Promise((resolve, reject) => {
    if (conn) {
      resolve(conn);
    } else {
      _pool.getConnection((err, conn) => {
        if (err) reject(err); // Reject this error
        else resolve(conn); // Resolve the connection
      })
    }
  });
}
function _checkConnection(conn) {
  // Return Promise for getConnection callback wrapping
  return new Promise((resolve, reject) => {
    if (conn) {
      resolve(conn);
    } else {
      _pool.getConnection((err, conn) => {
        if (err) reject(err); // Reject this error
        else resolve(conn); // Resolve the connection
      })
    }
  });
}
function _checkConnection ( conn ) { // Return Promise for getConnection callback wrapping return new Promise ( ( resolve , reject ) => { if ( conn ) { resolve ( conn ) ; } else { _pool . getConnection ( ( err , conn ) => { if ( err ) reject ( err ) ; // Reject this error else resolve ( conn ) ; // Resolve the connection } ) } } ) ; }
Check and return a connection, or get new connection from the pool
Check and return a connection or get new connection from the pool