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); };