summaryrefslogtreecommitdiffstats
path: root/packages/gitbook-core/src/reducers/page.js
blob: 98764c02e41de3cf41e852c7a57140e6d130e2cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
const { Record } = require('immutable');

const DEFAULTS = {
    title:   '',
    content: '',
    dir:     'ltr',
    depth:   1,
    level:   ''
};

class PageState extends Record(DEFAULTS) {
    static create(state) {
        return state instanceof PageState ?
            state : new PageState(state);
    }
}

module.exports = (state, action) => {
    return PageState.create(state);
};