summaryrefslogtreecommitdiffstats
path: root/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/preact/src/app/util.js
blob: 241ec1ad8be43fb10c9a2703c8a7e73453a07c2f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
export function uuid() {
    let uuid = '';
    for (let i = 0; i < 32; i++) {
        let random = Math.random() * 16 | 0;
        if (i === 8 || i === 12 || i === 16 || i === 20) {
            uuid += '-';
        }
        uuid += (i === 12 ? 4 : (i === 16 ? (random & 3 | 8) : random)).toString(16);
    }
    return uuid;
}

export function pluralize(count, word) {
    return count === 1 ? word : word + 's';
}

export function store(namespace, data) {
    // if (data) return localStorage[namespace] = JSON.stringify(data);

    // let store = localStorage[namespace];
    // return store && JSON.parse(store) || [];
    return [];
}