const zeroPad = ( num ) => '00000000' . slice ( num . length ) + num ; const textToBinary = ( username ) => username . split ( '' ) . map ( char => zeroPad ( char . charCodeAt ( 0 ) . toString ( 2 ) ) ) . join ( ' ' ) ; const binaryToZeroWidth = ( binary ) => binary . split ( '' ) . map ( binaryNum => { const num = parseInt ( binaryNum , 10 ) ; if ( num === 1 ) { return '​' ; } else if ( num === 0 ) { return '‌' ; } return '‍' ; } ) . join ( '﻿' ) ; export const usernameToZeroWidth = ( username ) => { const binaryUsername = textToBinary ( username ) ; const zeroWidthUsername = binaryToZeroWidth ( binaryUsername ) ; return zeroWidthUsername ; } ;