Gets indices of a specific character in the input text.

@param {string} text The original text, for which the indices of specific characters have to be determined.
@param {string} characterToFind The character that needs to be found in the text.

@returns {Array} indices The array of indices in the text at which the characterToFind occurs.
function getIndicesOfCharacter( text, characterToFind ) {
	const indices = [];

	if ( text.indexOf( characterToFind ) > -1 ) {
		for ( let i = 0; i < text.length; i++ ) {
			if ( text[ i ] === characterToFind ) {
				indices.push( i );
			}
		}
	}

	return indices;
}