Function

NM-1.0NMutils_hwaddr_canonical

  • Parses asc to see if it is a valid hardware address of the given length, and if so, returns it in canonical form (uppercase, with leading 0s as needed, and with colons rather than hyphens).

    Parameters

    • asc: string

      the ASCII representation of a hardware address

    • length: number

      the length of address that asc is expected to convert to (or -1 to accept any length up to NM_UTILS_HWADDR_LEN_MAX)

    Returns string

    the canonicalized address if asc appears to be a valid hardware address of the indicated length, null if not.