index.js
function closeDatabase (name) {
  var deferred = q.defer();

  // We need to be sure the database location exists
  ready.then(function () {
    clearTimeout(timeouts[name]);

    // Write to file
    write(name).then(function () {
      // Remove database from memory
      delete databases[name];

      deferred.resolve();
    }, function (err) {
      deferred.reject(err);
    });
  }, function () {
    deferred.reject('Database couldn\'t instantiate');
  });

  return deferred.promise;
}
function closeDatabase (name) {
  var deferred = q.defer();

  // We need to be sure the database location exists
  ready.then(function () {
    clearTimeout(timeouts[name]);

    // Write to file
    write(name).then(function () {
      // Remove database from memory
      delete databases[name];

      deferred.resolve();
    }, function (err) {
      deferred.reject(err);
    });
  }, function () {
    deferred.reject('Database couldn\'t instantiate');
  });

  return deferred.promise;
}
function closeDatabase ( name ) { var deferred = q . defer ( ) ; // We need to be sure the database location exists ready . then ( function ( ) { clearTimeout ( timeouts [ name ] ) ; // Write to file write ( name ) . then ( function ( ) { // Remove database from memory delete databases [ name ] ; deferred . resolve ( ) ; } , function ( err ) { deferred . reject ( err ) ; } ) ; } , function ( ) { deferred . reject ( 'Database couldn\'t instantiate' ) ; } ) ; return deferred . promise ; }
Closes a database and writes to file

@param  {[type]}
@return {[type]}
Closes a database and writes to file