Correct Sun formatting, update unit tests

This commit is contained in:
Eric A. Miller
2014-08-10 22:05:48 -04:00
parent 84270d40c4
commit c671bc3995
2 changed files with 31 additions and 18 deletions

View File

@@ -24,7 +24,7 @@ function formatMacAddress(macaddr, format) {
var fmac = '';
if (!mac.test(macaddr) || !fmt.test(format)) {
return '';
return macaddr;
} else {
macaddr = macaddr.replace(/[:-]/g, "").toLowerCase();
format = format.toLowerCase();
@@ -41,8 +41,13 @@ function formatMacAddress(macaddr, format) {
fmac = convertMacAddress(macaddr, "-", 2).toUpperCase();
break;
default:
case 'sun':
fmac = convertMacAddress(macaddr, ":", 2);
fmac = fmac.replace(/0([0-9A-F])/gi, '$1');
break;
default:
fmac = macaddr;
break;
}
}