UNPKG

cspace-ui

Version:
22 lines (21 loc) 815 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.get = exports.default = void 0; var _immutable = _interopRequireDefault(require("immutable")); var _actionCodes = require("../constants/actionCodes"); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var _default = (state = _immutable.default.Map(), action) => { switch (action.type) { case _actionCodes.ADD_OPTION_LISTS: return Object.keys(action.payload).reduce((newState, key) => newState.set(key, action.payload[key]), state); case _actionCodes.DELETE_OPTION_LIST: return state.delete(action.payload); default: return state; } }; exports.default = _default; const get = (state, optionListName) => state.get(optionListName); exports.get = get;