<commit_before>import './AST'
import './HtmlString'

const he = require('he')

export class Template {

	/**
	 * Finds the next index of an
	 * opening or closing parenthesis
	 *
	 * @param  {string} string    String to search in
	 * @param  {number} fromIndex Index to search from
	 * @return {number}           Index of the parenthesis or -1
	 */
	static nextIndexOfParenthesis(string, fromIndex) {
		const open = string.indexOf('(', fromIndex)
		const close = string.indexOf(')', fromIndex)

		if(open === -1) {
			return close
		} else if(close === -1)  {
			return open
		}

		return Math.min(open, close)
	}
<commit_msg>Added Template.nextIndexOf, a generic version of Template.nextIndexOfParenthesis * Template.nextIndexOf will now work with any number of characters * Template.nextIndexOfParenthesis has been changed to use Template.nextIndexOf<commit_after>import './AST'
import './HtmlString'

const he = require('he')

export class Template {

	/**
	 * Finds the next index of a set of characters
	 *
	 * @param  {string}    string    String to search in
	 * @param  {array|set} set       Array or set of characters to search for
	 * @param  {number}    fromIndex Index to search from
	 * @return {number}              Index of the parenthesis or -1
	 */
	static nextIndexOf(string, set, fromIndex) {
		let index = null

		for(const character of set) {
			const characterIndex = string.indexOf(character, fromIndex)

			if(characterIndex === -1) {
				continue
			}

			if(index === null) {
				index = characterIndex
			}

			index = Math.min(index, characterIndex)
		}

		if(index === null) {
			return -1
		}

		return index
	}

	/**
	 * Finds the next index of an
	 * opening or closing parenthesis
	 *
	 * @param  {string} string    String to search in
	 * @param  {number} fromIndex Index to search from
	 * @return {number}           Index of the parenthesis or -1
	 */
	static nextIndexOfParenthesis(string, fromIndex) {
		return this.nextIndexOf(string, [ '(', ')' ], fromIndex)
	}

{'fraction_non_alphanumeric': 0.1068931068931069, 'fraction_numerical': 0.0034965034965034965, 'mean_word_length': 3.0628803245436105, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1185023', 'n_tokens_mistral': 656, 'n_tokens_neox': 586, 'n_words': 208}