UNPKG

@redux-devtools/chart-monitor

Version:
25 lines (24 loc) 783 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = reducer; var _actions = require("./actions"); function toggleVisibility(props) { let state = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : props.defaultIsVisible; let action = arguments.length > 2 ? arguments[2] : undefined; if (action.type === _actions.TOGGLE_VISIBILITY) { return !state; } if (props.defaultIsVisible !== undefined) { return props.defaultIsVisible; } return true; } function reducer(props) { let state = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; let action = arguments.length > 2 ? arguments[2] : undefined; return { isVisible: toggleVisibility(props, state.isVisible, action) }; }