<commit_before>﻿import {TypeExpressionDefinition} from "./../definitions";
import {BaseWriter} from "./BaseWriter";

export enum TypeFormatFlags {
    None = 1 << 0,
    WriteArrayAsGenericType = 1 << 1
}

export class TypeExpressionWriter extends BaseWriter {
    write(typeExpression: TypeExpressionDefinition, formatFlags = TypeFormatFlags.None) {
        let text = typeExpression.text;

        if ((formatFlags & TypeFormatFlags.WriteArrayAsGenericType) != 0 && this.isArrayType(text)) {
            text = this.getAsGenericArrayType(text);
        }

        this.writer.write(text);
    }

    private isArrayType(text: string) {
        return /\[\]$/.test(text);
    }

    private getAsGenericArrayType(text: string) {
        return "Array<" + text.substring(0, text.length - 2) + ">";
    }
}
<commit_msg>#87 - Fixed != to !==<commit_after>﻿import {TypeExpressionDefinition} from "./../definitions";
import {BaseWriter} from "./BaseWriter";

export enum TypeFormatFlags {
    None = 1 << 0,
    WriteArrayAsGenericType = 1 << 1
}

export class TypeExpressionWriter extends BaseWriter {
    write(typeExpression: TypeExpressionDefinition, formatFlags = TypeFormatFlags.None) {
        let text = typeExpression.text;

        if ((formatFlags & TypeFormatFlags.WriteArrayAsGenericType) !== 0 && this.isArrayType(text)) {
            text = this.getAsGenericArrayType(text);
        }

        this.writer.write(text);
    }

    private isArrayType(text: string) {
        return /\[\]$/.test(text);
    }

    private getAsGenericArrayType(text: string) {
        return "Array<" + text.substring(0, text.length - 2) + ">";
    }
}

{'fraction_non_alphanumeric': 0.13130699088145897, 'fraction_numerical': 0.009726443768996961, 'mean_word_length': 3.12531328320802, 'pattern_counts': {'":': 0, '<': 13, '<?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': '4993812', 'n_tokens_mistral': 491, 'n_tokens_neox': 470, 'n_words': 103}