Skip to content

Commit c4b2615

Browse files
Typing improvements
1 parent e1c2292 commit c4b2615

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/stores/fragment.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const DPS = 5;
2929

3030
const parseHash = (): Store => {
3131
const params = new URLSearchParams(window.location.hash.substring(1));
32-
const getNum = (key: string) => parseFloat(params.get(key));
32+
const getNum = (key: string) => parseFloat(params.get(key) || '0');
3333

3434
return {
3535
position: {
@@ -39,11 +39,11 @@ const parseHash = (): Store => {
3939
rotation: getNum('rotation')
4040
},
4141
featureLayers: (params.get('layers') ?? '').split(',').filter(x => x),
42-
baseLayer: parseInt(params.get('baseLayer')) || 0,
42+
baseLayer: parseInt(params.get('baseLayer') ?? '0') || 0,
4343
label: {
4444
lat: getNum('lla'),
4545
lng: getNum('llo'),
46-
text: params.get('lab')
46+
text: params.get('lab') ?? ''
4747
},
4848
page: params.get('page') as Pages
4949
}

0 commit comments

Comments
 (0)