Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | 119x 119x 1690x 254x 119x 119x 208x 23x | /**
* Most of CodeCharta's action will reset when action's payload is undefined.
* E.g., this has currently an effect when applying a scenario without map colors,
* to ensure that it will have default colors.
*/
import { Action } from "@ngrx/store"
export const setState =
<T>(defaultValue: T) =>
(_state: T, action: Action & { value: T }) =>
action.value === undefined ? defaultValue : action.value
export const mergeState =
<T>(defaultValue: T) =>
(state: T, action: Action & { value: Partial<T> }): T =>
action.value === undefined ? defaultValue : { ...state, ...action.value }
|