| Total Complexity | 6 |
| Complexity/F | 1.5 |
| Lines of Code | 34 |
| Function Count | 4 |
| Duplicated Lines | 0 |
| Ratio | 0 % |
| Coverage | 83.33% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | import L from 'leaflet'; |
||
| 2 | import marker2x from 'leaflet/dist/images/marker-icon-2x.png'; |
||
| 3 | import marker from 'leaflet/dist/images/marker-icon.png'; |
||
| 4 | import markerShadow from 'leaflet/dist/images/marker-shadow.png'; |
||
| 5 | |||
| 6 | 5 | const DEFAULT_TIMEOUT_DELAY = 2000; |
|
| 7 | |||
| 8 | 5 | export const stateFlagTimeout = (setState, flagName, initialValue = true, delay = DEFAULT_TIMEOUT_DELAY) => { |
|
| 9 | 1 | setState({ [flagName]: initialValue }); |
|
| 10 | 1 | setTimeout(() => setState({ [flagName]: !initialValue }), delay); |
|
| 11 | }; |
||
| 12 | |||
| 13 | 5 | export const determineOrderDir = (clickedField, currentOrderField, currentOrderDir) => { |
|
| 14 | 3 | if (currentOrderField !== clickedField) { |
|
| 15 | 2 | return 'ASC'; |
|
| 16 | } |
||
| 17 | |||
| 18 | 1 | const newOrderMap = { |
|
| 19 | ASC: 'DESC', |
||
| 20 | DESC: undefined, |
||
| 21 | }; |
||
| 22 | |||
| 23 | 2 | return currentOrderDir ? newOrderMap[currentOrderDir] : 'ASC'; |
|
| 24 | }; |
||
| 25 | |||
| 26 | 5 | export const fixLeafletIcons = () => { |
|
| 27 | delete L.Icon.Default.prototype._getIconUrl; |
||
| 28 | |||
| 29 | L.Icon.Default.mergeOptions({ |
||
| 30 | iconRetinaUrl: marker2x, |
||
| 31 | iconUrl: marker, |
||
| 32 | shadowUrl: markerShadow, |
||
| 33 | }); |
||
| 34 | }; |
||
| 35 |