I'm trying to retrieve some data from the Firebase database, and at the same time export this data as a module because it will be reused in other parts of the project. The code below returns an undefined object.
const admin = require('firebase-admin');
const firebaseDatabase = admin.database();
const firebaseRef = firebaseDatabase.ref('users');
/**
 * @description
 * Retrieves names from Firebase db
 * @param {String} id
 */
module.exports = function(id){
  firebaseRef.on('value', function(snapshot) {
    return snapshot.val()[id];
  }, function(err) {
    return false;
  });
};
