Refactoring: Split shared types into seperate modules and document alot.

This commit is contained in:
baldo 2022-09-06 19:09:25 +02:00
parent e08ae944c4
commit 843cd37243
31 changed files with 2498 additions and 842 deletions
server/shared/utils

View file

@ -0,0 +1,14 @@
/**
* Utility functions for node related data.
*/
import { MAC, MapId } from "../types";
/**
* Converts the MAC address of a Freifunk node to an id representing it on the community's node map.
*
* @param mac - MAC address of the node
* @returns ID of the node on the map
*/
export function mapIdFromMAC(mac: MAC): MapId {
return mac.toLowerCase().replace(/:/g, "") as MapId;
}