<commit_before>package util

import "strings"
import "github.com/appPlant/alpinepass/src/data"
import "encoding/json"

import "os"
import "fmt"

//CheckError throws an exception if an error exists.
func CheckError(err error) {
	if err != nil {
		panic(err)
	}
}

// Filler is used to replace spaces in strings.
const Filler string = "_"

//CleanString removes whitespace in string.
func CleanString(s string) string {
	return strings.Replace(s, " ", Filler, -1)
}

//ThrowError prints the error information and exits the application.
func ThrowError(message string) {
	os.Stderr.WriteString(message)
	fmt.Println()
	os.Exit(-1)
}

//ThrowConfigError prints the error, some information about a Config and exits the application.
func ThrowConfigError(message string, config data.Config) {
	var configJSON []byte
	var err error
	configJSON, err = json.MarshalIndent(config, "", "    ")
	CheckError(err)

	os.Stderr.WriteString(message)
	fmt.Println()
	os.Stderr.WriteString(string(configJSON))
	fmt.Println()
	os.Exit(-1)
}<commit_msg>Commit add helper function for checking if a string is contained in an array<commit_after>package util

import "strings"
import "github.com/appPlant/alpinepass/src/data"
import "encoding/json"

import "os"
import "fmt"

//CheckError throws an exception if an error exists.
func CheckError(err error) {
	if err != nil {
		panic(err)
	}
}

// Filler is used to replace spaces in strings.
const Filler string = "_"

//CleanString removes whitespace in string.
func CleanString(s string) string {
	return strings.Replace(s, " ", Filler, -1)
}

//ThrowError prints the error information and exits the application.
func ThrowError(message string) {
	os.Stderr.WriteString(message)
	fmt.Println()
	os.Exit(-1)
}

//ThrowConfigError prints the error, some information about a Config and exits the application.
func ThrowConfigError(message string, config data.Config) {
	var configJSON []byte
	var err error
	configJSON, err = json.MarshalIndent(config, "", "    ")
	CheckError(err)

	os.Stderr.WriteString(message)
	fmt.Println()
	os.Stderr.WriteString(string(configJSON))
	fmt.Println()
	os.Exit(-1)
}

//StringInArray checks if a string is contained in an array.
func StringInArray(item string, array []string) bool {
	for i := 0; i < len(array); i++ {
		if item == array[i] {
			return true
		}
	}
	return false
}
{'fraction_non_alphanumeric': 0.11149081589064502, 'fraction_numerical': 0.00299017513882956, 'mean_word_length': 4.3963133640553, 'pattern_counts': {'":': 0, '<': 4, '<?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': '5853833', 'n_tokens_mistral': 764, 'n_tokens_neox': 746, 'n_words': 240}