Could there be a more streamlined solution for this code snippet I have?
/**
* Converts serial from '86FC64484BE99E78' to '86:FC:64:48:4B:E9:9E:78'
* @param serial
*/
private formatSerial(serial: string): string {
return serial.split('').reduce(
(prev, curr, index, arr) => {
let part = prev + curr;
if ((index % 2 === 1) && (index !== arr.length - 1)) {
part += ':';
}
return part;
},
'',
);
}