Total Complexity | 6 |
Complexity/F | 1.5 |
Lines of Code | 32 |
Function Count | 4 |
Duplicated Lines | 0 |
Ratio | 0 % |
Coverage | 100% |
Changes | 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 | import { isEmpty, isNil, range } from 'ramda'; |
||
6 | |||
7 | 23 | export const determineOrderDir = (clickedField, currentOrderField, currentOrderDir) => { |
|
8 | 27 | if (currentOrderField !== clickedField) { |
|
9 | 10 | return 'ASC'; |
|
10 | } |
||
11 | |||
12 | 17 | const newOrderMap = { |
|
13 | ASC: 'DESC', |
||
14 | DESC: undefined, |
||
15 | }; |
||
16 | |||
17 | 17 | return currentOrderDir ? newOrderMap[currentOrderDir] : 'ASC'; |
|
18 | }; |
||
19 | |||
20 | 23 | export const fixLeafletIcons = () => { |
|
21 | 1 | delete L.Icon.Default.prototype._getIconUrl; |
|
22 | |||
23 | 1 | L.Icon.Default.mergeOptions({ |
|
24 | iconRetinaUrl: marker2x, |
||
25 | iconUrl: marker, |
||
26 | shadowUrl: markerShadow, |
||
27 | }); |
||
28 | }; |
||
29 | |||
30 | 39 | export const rangeOf = (size, mappingFn, startAt = 1) => range(startAt, size + 1).map(mappingFn); |
|
31 | |||
32 | export const hasValue = (value) => !isNil(value) && !isEmpty(value); |
||
33 |