mirror of
https://github.com/grafana/grafana.git
synced 2024-11-26 02:40:26 -06:00
8 lines
216 B
TypeScript
8 lines
216 B
TypeScript
|
export type MutateStateFunc<S> = (state: S) => S;
|
||
|
|
||
|
export const applyStateChanges = <S>(state: S, ...args: Array<MutateStateFunc<S>>): S => {
|
||
|
return args.reduce((all, cur) => {
|
||
|
return cur(all);
|
||
|
}, state);
|
||
|
};
|