Returns the indices of a string in a text. If it is found multiple times, it will return multiple indices.

@param {string} word The word to find in the text.
@param {string} text The text to check for the given word.
@returns {Array} All indices found.
function getIndicesByWord( word, text ) {
	var startIndex = 0;
	var searchStringLength = word.length;
	var index, indices = [];
	while ( ( index = text.indexOf( word, startIndex ) ) > -1 ) {
		// Check if the previous and next character are word boundaries to determine if a complete word was detected
		var isPreviousCharacterWordBoundary = characterInBoundary( text[ index - 1 ] ) || index === 0;

		var isNextCharacterWordBoundary = characterInBoundary( text[ index + searchStringLength ] ) || ( text.length === index + searchStringLength );

		if ( isPreviousCharacterWordBoundary && isNextCharacterWordBoundary ) {
			indices.push(
				{
					index: index,
					match: word,
				}
			);
		}
		startIndex = index + searchStringLength;
	}
	return indices;
}