(...args: {}[])
| 61 | - (actions: <array/List>, data: <object/Map>, meta: <optional object/Map>) -> cursor |
| 62 | */ |
| 63 | function createCursorStore(...args: {}[]) { |
| 64 | const { actions, data, meta } = |
| 65 | args.length === 1 |
| 66 | ? jsToMap(args[0]).toObject() |
| 67 | : { actions: args[0], data: args[1], meta: args[2] }; |
| 68 | return Map({ |
| 69 | // actions are a Set, rather than a List, to ensure an efficient .has |
| 70 | actions: Set(actions), |
| 71 | |
| 72 | // data and meta are Maps |
| 73 | data: jsToMap(data), |
| 74 | meta: jsToMap(meta).update(filterUnknownMetaKeys), |
| 75 | }) as CursorStore; |
| 76 | } |
| 77 | |
| 78 | function hasAction(store: CursorStore, action: string) { |
| 79 | return store.hasIn(['actions', action]); |
no test coverage detected