Refactoring: Split shared types into seperate modules and document alot.
This commit is contained in:
parent
e08ae944c4
commit
843cd37243
31 changed files with 2498 additions and 842 deletions
server/shared/utils
14
server/shared/utils/node.ts
Normal file
14
server/shared/utils/node.ts
Normal 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;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue