<commit_before>(function() {
    var KEY = 'GIFS';

    function getData() {
        return JSON.parse(localStorage.getItem(KEY)) || [];
    }

    // TO REMOVE @ SOME POINT
    if (!localStorage.getItem('gifs_v2')) {
        console.log('running migration');

        chrome.storage.local.get('gifs_v2', function(data) {
            var transformed = data.gifs_v2.map(function(obj) {
                return {
                    id: uuid.v4(),
                    name: obj.name,
                    url: obj.imgur_url || obj.url,
                    still_url: obj.imgur_square
                };
            });
            localStorage.setItem(KEY, JSON.stringify(transformed));

            localStorage.setItem('gifs_v2', new Date());
            console.log('migration done');
        });
    }

    // Priority Migration
    (function() {
        var data = getData(),
            transformed = data.map(function(o) {
                if (o.priority >= 0) {
                    return o;
                } else {
                    o.priority = 0;
                    return o;
                }
            });

        localStorage.setItem(KEY, JSON.stringify(transformed));
    })();

    // Object Migration
    (function() {
        var data = getData();

        if (Array.isArray(data)) {
            transformed = {},
                data.forEach(function(o) {
                    transformed[o.id] = o;
                });

            localStorage.setItem(KEY, JSON.stringify(transformed));
        }
    })();

    function clickHandler(info) {
        var name = prompt("Name? "),
            data = getData(),
            gif = {
                id: uuid.v4(),
                name: name,
                url: info.srcUrl,
                still_url: info.srcUrl
            };

        data.push(gif);

        localStorage.setItem(KEY, JSON.stringify(data));
    }

    chrome.contextMenus.create({
        title: "Save Gif",
        contexts: ["image"],
        onclick: clickHandler
    });
})();<commit_msg>Update background upload to reflect change of type (array to obj)<commit_after>(function() {
    var KEY = 'GIFS';

    function getData() {
        return JSON.parse(localStorage.getItem(KEY)) || [];
    }

    // TO REMOVE @ SOME POINT
    if (!localStorage.getItem('gifs_v2')) {
        console.log('running migration');

        chrome.storage.local.get('gifs_v2', function(data) {
            var transformed = data.gifs_v2.map(function(obj) {
                return {
                    id: uuid.v4(),
                    name: obj.name,
                    url: obj.imgur_url || obj.url,
                    still_url: obj.imgur_square
                };
            });
            localStorage.setItem(KEY, JSON.stringify(transformed));

            localStorage.setItem('gifs_v2', new Date());
            console.log('migration done');
        });
    }

    // Priority Migration
    (function() {
        var data = getData(),
            transformed = data.map(function(o) {
                if (o.priority >= 0) {
                    return o;
                } else {
                    o.priority = 0;
                    return o;
                }
            });

        localStorage.setItem(KEY, JSON.stringify(transformed));
    })();

    // Object Migration
    (function() {
        var data = getData();

        if (Array.isArray(data)) {
            transformed = {},
                data.forEach(function(o) {
                    transformed[o.id] = o;
                });

            localStorage.setItem(KEY, JSON.stringify(transformed));
        }
    })();

    function clickHandler(info) {
        var name = prompt("Name? "),
            data = getData(),
            id = uuid.v4(),
            gif = {
                id: id,
                name: name,
                url: info.srcUrl,
                still_url: info.srcUrl
            };

        data[id] = gif;

        localStorage.setItem(KEY, JSON.stringify(data));
    }

    chrome.contextMenus.create({
        title: "Save Gif",
        contexts: ["image"],
        onclick: clickHandler
    });
})();
{'fraction_non_alphanumeric': 0.1310128112158569, 'fraction_numerical': 0.0038675368624607204, 'mean_word_length': 1.3444759206798866, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '5065819', 'n_tokens_mistral': 1177, 'n_tokens_neox': 1099, 'n_words': 211}