Skip to content

Commit

Permalink
fix: remove unnecessary null checks
Browse files Browse the repository at this point in the history
  • Loading branch information
nobkd committed Apr 5, 2023
1 parent 852fdde commit 907aada
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/map/utils/parsePB.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ function convertType(item: string): [string | TileType | number, boolean] {
val = parseInt(item);
break;
case 'e': // enum
let temp = parseInt(item) ?? 0;
val = tileTypes[temp < tileTypes.length && temp >= 0 ? temp : 0];
let tileIndex = parseInt(item);
val = tileTypes[tileIndex < tileTypes.length && tileIndex >= 0 ? tileIndex : 0];
break;
case 'z': // base64 encoded coords
val = atob(item).replace(/[^\d\s\-\.\'\"\°SNWE]/g, '');
Expand Down
2 changes: 1 addition & 1 deletion src/map/utils/read.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export async function readPB(param: string): Promise<MapData> {
lon: mapArea[1],
};

mapData.zoom = getMapZoom(mapArea[0]) ?? 17;
mapData.zoom = getMapZoom(mapArea[0]);

let currMarkers: any[] | string = data[1];
if (typeof currMarkers !== 'string') {
Expand Down

0 comments on commit 907aada

Please sign in to comment.