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

class ReadmeState extends Record({
    file: new FileState()
}) {
    constructor(state = {}) {
        super({
            file: new FileState(state.file)
        });
    }

    static create(state) {
        return state instanceof ReadmeState ?
            state : new ReadmeState(state);
    }
}

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