2022-09-06 19:09:25 +02:00
|
|
|
/**
|
|
|
|
* Utility functions for node related data.
|
|
|
|
*/
|
2022-09-14 16:33:43 +02:00
|
|
|
import type { MAC, MapId } from "../types";
|
2022-09-06 19:09:25 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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;
|
|
|
|
}
|