index.js
function calculateCountOfReplacementChar(string, replaceByChar = ' ') {
	var characters = 0
	string
		.split('')
		.forEach(char => {
			var size = charSizes.get(char) || 1
			characters += size
		})
	// All sizes were measured against space char. Recalculate if needed.
	if (replaceByChar !== ' ')
		characters = characters / charSizes.get(replaceByChar)
	return Math.round(characters)
}
function calculateCountOfReplacementChar(string, replaceByChar = ' ') {
	var characters = 0
	string
		.split('')
		.forEach(char => {
			var size = charSizes.get(char) || 1
			characters += size
		})
	// All sizes were measured against space char. Recalculate if needed.
	if (replaceByChar !== ' ')
		characters = characters / charSizes.get(replaceByChar)
	return Math.round(characters)
}
function calculateCountOfReplacementChar ( string , replaceByChar = ' ' ) { var characters = 0 string . split ( '' ) . forEach ( char => { var size = charSizes . get ( char ) || 1 characters += size } ) // All sizes were measured against space char. Recalculate if needed. if ( replaceByChar !== ' ' ) characters = characters / charSizes . get ( replaceByChar ) return Math . round ( characters ) }
Calculates how many space characters should be displayed in place of given string argument. We sum widths of each character in the string because the text cannot be displayed in monospace font.
Calculates how many space characters should be displayed in place of given string argument . We sum widths of each character in the string because the text cannot be displayed in monospace font .