<commit_before>/**
 * public/src/js/prep.js - delish
 * 
 * Licensed under MIT license.
 * Copyright (C) 2017 <NAME>.
 */

import log from './logger'
import Map from './map'

/**
 * Promise-ify Google map success.
 */
const mapReady = new Promise(resolve => {
  window.initMap = resolve
})

/**
 * List of tasks, in the order that they
 * must be executed.
 */
const tasks = {
  order: [
    'Creating sexy map'
  ],

  /**
   * Creates a new Google map instance
   */
  'Creating sexy map': (resolve, reject) => {
    mapReady.then(() => {
      let map = document.createElement('div')
      map.id = 'map'
      document.body.appendChild(map)
      window.Map = new Map(map)

      resolve()
    }).catch(reject)
  }
}

/**
 * Handle task failure.
 */
const loading = document.querySelector('.loading-screen')
function fail(err) {
  log(String(err))
  loading.classList.add('error')
}

/**
 * Executes tasks sequentionally.
 */
let i = -1
function next() {
  i += 1

  if (i === tasks.order.length) {
    log('Okay I\'m ready now.')

    setTimeout(() => {
      document.documentElement.classList.remove('loading')
    }, 1000)
  } else {
    let text = tasks.order[i]
    log(text + ' ...')

    new Promise(tasks[text])
      .then(next)
      .catch(fail)
  }
}

// start task execution, soon
setTimeout(next, 0)<commit_msg>Fix the order of things<commit_after>/**
 * public/src/js/prep.js - delish
 * 
 * Licensed under MIT license.
 * Copyright (C) 2017 <NAME>.
 */

import log from './logger'
import Map from './map'

/**
 * Promise-ify Google map success.
 */
const mapReady = new Promise(resolve => {
        window.initMap = resolve
      })
    , loading = document.querySelector('.loading-screen')

/**
 * List of tasks, in the order that they
 * must be executed.
 */
const tasks = {
  order: [
    'Creating sexy map'
  ],

  /**
   * Creates a new Google map instance
   */
  'Creating sexy map': (resolve, reject) => {
    mapReady.then(() => {
      let map = document.createElement('div')
      map.id = 'map'
      document.body.insertBefore(map, loading)
      window.Map = new Map(map)

      resolve()
    }).catch(reject)
  }
}

/**
 * Handle task failure.
 */
function fail(err) {
  log(String(err))
  loading.classList.add('error')
}

/**
 * Executes tasks sequentionally.
 */
function next() {
  i += 1

  if (i === tasks.order.length) {
    log('Okay I\'m ready now.')

    setTimeout(() => {
      document.documentElement.classList.remove('loading')
    }, 1000)
  } else {
    let text = tasks.order[i]
    log(text + ' ...')

    new Promise(tasks[text])
      .then(next)
      .catch(fail)
  }
}

// start task execution, soon
let i = -1
setTimeout(next, 0)
{'fraction_non_alphanumeric': 0.16419019316493313, 'fraction_numerical': 0.008172362555720654, 'mean_word_length': 2.5341207349081363, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, 'https://': 0, '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': '4188171', 'n_tokens_mistral': 906, 'n_tokens_neox': 874, 'n_words': 231}