equal
deleted
inserted
replaced
|
1 import * as R from 'ramda'; |
|
2 import { ActionEnum } from '../constants'; |
|
3 |
|
4 export const getId = R.prop('_id'); |
|
5 export const idEq = R.propEq('_id'); |
|
6 export const setAction = actionEnum => R.flip(R.merge)({action: actionEnum}) |
|
7 |
|
8 export const getNewAction = action => { |
|
9 switch (action) { |
|
10 case ActionEnum.CREATED: |
|
11 return ActionEnum.CREATED; |
|
12 case ActionEnum.DELETED: // should not happen, but... |
|
13 return ActionEnum.DELETED; |
|
14 default: |
|
15 return ActionEnum.UPDATED; |
|
16 } |
|
17 } |
|
18 |