src/researches/findTransitionWords.js
function( sentences, transitionWords ) {
	const results = [];

	sentences.forEach( sentence => {
		const twoPartMatches = matchTwoPartTransitionWords( sentence, transitionWords.twoPartTransitionWords() );

		if ( twoPartMatches !== null ) {
			results.push( {
				sentence: sentence,
				transitionWords: twoPartMatches,
			} );

			return;
		}

		const transitionWordMatches = matchTransitionWords( sentence, transitionWords.transitionWords );

		if ( transitionWordMatches.length !== 0 ) {
			results.push( {
				sentence: sentence,
				transitionWords: transitionWordMatches,
			} );

			return;
		}
	} );

	return results;
}
function( sentences, transitionWords ) {
	const results = [];

	sentences.forEach( sentence => {
		const twoPartMatches = matchTwoPartTransitionWords( sentence, transitionWords.twoPartTransitionWords() );

		if ( twoPartMatches !== null ) {
			results.push( {
				sentence: sentence,
				transitionWords: twoPartMatches,
			} );

			return;
		}

		const transitionWordMatches = matchTransitionWords( sentence, transitionWords.transitionWords );

		if ( transitionWordMatches.length !== 0 ) {
			results.push( {
				sentence: sentence,
				transitionWords: transitionWordMatches,
			} );

			return;
		}
	} );

	return results;
}
Checks the passed sentences to see if they contain transition words.

@param {Array} sentences The sentences to match against.
@param {Object} transitionWords The object containing both transition words and two part transition words.
@returns {Array} Array of sentence objects containing the complete sentence and the transition words.