<commit_before>'use strict'

module.exports = function(data) {
    if (!data)
        data = {}

    function add(time, entry) {
        if (!data[time])
            data[time] = []

        entry.timestamp = Date.now()
        data[time].push(entry)

        data[time] = data[time].sort((a, b) => {
            return (a.start > b.start) ? -1 : 1
        })
    }

    function pop() {
        if (data.queue)
            return data.queue.pop()
    }

    function rm(time, index) {
        if (data[time])
            data[time].splice(index - 1, 1)

        if (data[time].length == 0)
            delete data[time]
    }

    function print(time) {
        function fmtTime(d) {
            return `${d.getHours()}.${d.getMinutes()}`
        }

        if (data[time] && data[time].length > 0) {
            const date = new Date(Number(time)),
                  opts = { weekday: "long", day: "numeric", month: "short", year: "numeric" }
            console.log(date.toLocaleDateString("sv-SE", opts))

            data[time].forEach((n, i) => {
                const d = (n.duration / (1000 * 60 * 60)).toFixed(2),
                      start = fmtTime(new Date(n.start)),
                      stop = fmtTime(new Date(n.stop))

                console.log(`    (${i+1}) ${start}-${stop} => ${d} hrs   ${n.activity} [${(n.tags) ? n.tags.join(' ') : ''}]`)
            })
        }
    }

    return {
        add,
        rm,
        pop,
        data
    }
}<commit_msg>delete print<commit_after>'use strict'

module.exports = function(data) {
    if (!data)
        data = {}

    function add(time, entry) {
        if (!data[time])
            data[time] = []

        entry.timestamp = Date.now()
        data[time].push(entry)

        data[time] = data[time].sort((a, b) => {
            return (a.start > b.start) ? -1 : 1
        })
    }

    function pop() {
        if (data.queue)
            return data.queue.pop()
    }

    function rm(time, index) {
        if (data[time])
            data[time].splice(index - 1, 1)

        if (data[time].length == 0)
            delete data[time]
    }

    return {
        add,
        rm,
        pop,
        data
    }
}
{'fraction_non_alphanumeric': 0.16628597533120146, 'fraction_numerical': 0.009593421653723162, 'mean_word_length': 1.4745762711864407, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 10, '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': '1949117', 'n_tokens_mistral': 731, 'n_tokens_neox': 691, 'n_words': 144}