<commit_before>'use strict'
const firebase = require('firebase/app')
require("firebase/auth")
require("firebase/database")

const config = {
    apiKey: '<KEY>',
    authDomain: 'myapp-83a73.firebaseapp.com',
    databaseURL: 'https://myapp-83a73.firebaseio.com',
    storageBucket: 'myapp-83a73.appspot.com'
  }

firebase.initializeApp(config)

module.exports = {
  addProject(proj) {
    let projects = firebase.database().ref('projects')
    projects.push(proj)
  },
  deleteProject(projID, callback) {
    let project = firebase.database().ref('projects/'+projID)
    project.set(null)
      .then(() => {
        return project.once("value")
      })
      .then((snapshot) => {
        callback()
      })
  },
  getProjectsFromServer(callback) {
    let projects = firebase.database().ref('projects')
    projects.once('value')
      .then((snapshot) => {
        callback(snapshot.val())
      })
  },
}<commit_msg>getProjects and listenToProjects added, wich return promises<commit_after>'use strict'
const firebase = require('firebase/app')
require("firebase/auth")
require("firebase/database")

const config = {
    apiKey: '<KEY>',
    authDomain: 'myapp-83a73.firebaseapp.com',
    databaseURL: 'https://myapp-83a73.firebaseio.com',
    storageBucket: 'myapp-83a73.appspot.com'
  }

firebase.initializeApp(config)

module.exports = {
  getProjects() {
    return firebase.database().ref('projects').once('value')
  },
  listenToProjects(callback) {
    firebase.database().ref('projects').on('value',
      ()=>{callback()}
    )
  },
  addProject(proj) {
    let projects = firebase.database().ref('projects')
    projects.push(proj)
  },
  deleteProject(projID, callback) {
    let project = firebase.database().ref('projects/'+projID)
    project.set(null)
      .then(() => {
        return project.once("value")
      })
      .then((snapshot) => {
        callback()
      })
      .catch((e)=>console.warn(e))
  },
  getProjectsFromServer(callback) {
    let projects = firebase.database().ref('projects')
    projects.once('value')
      .then((snapshot) => {
        callback(snapshot.val())
      })
  },
}
{'fraction_non_alphanumeric': 0.171911695631752, 'fraction_numerical': 0.011272898074213245, 'mean_word_length': 3.3737166324435317, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5076963', 'n_tokens_mistral': 706, 'n_tokens_neox': 693, 'n_words': 97}