<commit_before>import { defaultsDeep, cloneDeep } from 'lodash/fp';
const uuidV4 = require('uuid/v4');

const list = () => {
    return new Promise(resolve => {
        const arr = [];
        for (let i = 0; i < localStorage.length; i++) {
            if(localStorage.key(i).startsWith('presentation')){
                arr.push(JSON.parse(localStorage.getItem(localStorage.key(i))))
            }
        }
        resolve(arr);
    })
};

const get = (id) => {
    return new Promise(resolve => {
        const presentation = localStorage.getItem(`presentation-${id}`);
        if (! presentation) throw new Error(`No presentation with ID ${id} found.`);
        resolve(JSON.parse(presentation));
    })
};

const create = presentation => {
    // Todo: validate the input
    return new Promise(resolve => {
            const toSave = {
                id: uuidV4(),
                title: presentation.title,
                wpId: presentation.wpId,
                version: presentation.version,
                description: presentation.description,
                slides: presentation.slides.map(singleSlide => Object.assign({}, singleSlide, {id: uuidV4()}))<commit_msg>Add authorName to create<commit_after>import { defaultsDeep, cloneDeep } from 'lodash/fp';
const uuidV4 = require('uuid/v4');

const list = () => {
    return new Promise(resolve => {
        const arr = [];
        for (let i = 0; i < localStorage.length; i++) {
            if(localStorage.key(i).startsWith('presentation')){
                arr.push(JSON.parse(localStorage.getItem(localStorage.key(i))))
            }
        }
        resolve(arr);
    })
};

const get = (id) => {
    return new Promise(resolve => {
        const presentation = localStorage.getItem(`presentation-${id}`);
        if (! presentation) throw new Error(`No presentation with ID ${id} found.`);
        resolve(JSON.parse(presentation));
    })
};

const create = presentation => {
    // Todo: validate the input
    return new Promise(resolve => {
            const toSave = {
                id: uuidV4(),
                title: presentation.title,
                wpId: presentation.wpId,
                version: presentation.version,
                authorName: presentation.authorName,
                description: presentation.description,
                slides: presentation.slides.map(singleSlide => Object.assign({}, singleSlide, {id: uuidV4()}))
{'fraction_non_alphanumeric': 0.13655115511551155, 'fraction_numerical': 0.004125412541254125, 'mean_word_length': 2.2550335570469797, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, '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': '4716220', 'n_tokens_mistral': 662, 'n_tokens_neox': 654, 'n_words': 150}