<commit_before>import {Inject} from "di-ts";

@Inject
export class UtilityService {

  toBoolean(value: any, ensureBoolean = false) {

    if(value === void 0 && ensureBoolean) {

      return false;
    }

    switch (typeof value) {
      case 'string':
        return value === 'true';
      case 'number':
        return value === 1;
      case 'object':
        return true;
      case 'boolean':
        return value;
      default:
        return null;
    }
  }

  toArray<T>(value: any, ensureArray = false): T[] {

    if(value === void 0) {<commit_msg>bug fix<commit_after>import {Inject} from "di-ts";

@Inject
export class UtilityService {

  toBoolean(value: any, ensureBoolean = false) {

    if(value === void 0 && ensureBoolean) {

      return false;
    }

    switch (typeof value) {
      case 'string':
        return value === 'true';
      case 'number':
        return value === 1;
      case 'object':
        return true;
      case 'boolean':
      default:
        return value;
    }
  }

  toArray<T>(value: any, ensureArray = false): T[] {

    if(value === void 0) {
{'fraction_non_alphanumeric': 0.13557779799818018, 'fraction_numerical': 0.00545950864422202, 'mean_word_length': 2.216374269005848, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '6509236', 'n_tokens_mistral': 347, 'n_tokens_neox': 330, 'n_words': 99}