| author | ymh <ymh.work@gmail.com> |
| Mon, 08 Oct 2018 18:35:47 +0200 | |
| changeset 168 | ea92f4fe783d |
| permissions | -rw-r--r-- |
|
168
ea92f4fe783d
- move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
1 |
import * as R from 'ramda'; |
|
ea92f4fe783d
- move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
2 |
import { ActionEnum } from '../constants'; |
|
ea92f4fe783d
- move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
3 |
|
|
ea92f4fe783d
- move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
4 |
export const getId = R.prop('_id'); |
|
ea92f4fe783d
- move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
5 |
export const idEq = R.propEq('_id'); |
|
ea92f4fe783d
- move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
6 |
export const setAction = actionEnum => R.flip(R.merge)({action: actionEnum}) |
|
ea92f4fe783d
- move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
7 |
|
|
ea92f4fe783d
- move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
8 |
export const getNewAction = action => { |
|
ea92f4fe783d
- move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
9 |
switch (action) { |
|
ea92f4fe783d
- move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
10 |
case ActionEnum.CREATED: |
|
ea92f4fe783d
- move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
11 |
return ActionEnum.CREATED; |
|
ea92f4fe783d
- move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
12 |
case ActionEnum.DELETED: // should not happen, but... |
|
ea92f4fe783d
- move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
13 |
return ActionEnum.DELETED; |
|
ea92f4fe783d
- move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
14 |
default: |
|
ea92f4fe783d
- move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
15 |
return ActionEnum.UPDATED; |
|
ea92f4fe783d
- move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
16 |
} |
|
ea92f4fe783d
- move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
17 |
} |
|
ea92f4fe783d
- move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
18 |