<commit_before>var pageProperty = require('./pageProperty');

class PageType {
    validatePage(page, pageType) {
        if (typeof page == 'undefined') {
            throw new ReferenceError('page is undefined');
        }

        if (typeof page != 'object' || page === null) {
            throw new TypeError('page must be an object');
        }
    }

    validatePageType(pageType) {
        if (typeof pageType == 'undefined') {
            throw new ReferenceError('pageType is undefined');
        }

        if (typeof pageType != 'string') {
            throw new TypeError('pageType must be a string');
        }
    }

    getPropertyName(pageType) {
        this.validatePageType(pageType);
        return `is${pageType[0].toUpperCase()}${pageType.slice(1)}`;
    }

    is(page, pageType) {
        this.validatePage(page);
        this.validatePageType(pageType);

        var propertyName = this.getPropertyName(pageType);
        return pageProperty.isTrue(page, propertyName);
    }
};

module.exports = PageType;<commit_msg>Tidy up PageType class<commit_after>var pageProperty = require('./pageProperty');

class PageType {

    validatePage(page, pageType) {
        if (typeof page == 'undefined') {
            throw new ReferenceError('page is undefined');
        }

        if (typeof page != 'object' || page === null) {
            throw new TypeError('page must be an object');
        }
    }

    validatePageType(pageType) {
        if (typeof pageType == 'undefined') {
            throw new ReferenceError('pageType is undefined');
        }

        if (typeof pageType != 'string') {
            throw new TypeError('pageType must be a string');
        }
    }

    getPropertyName(pageType) {
        this.validatePageType(pageType);
        return `is${pageType[0].toUpperCase()}${pageType.slice(1)}`;
    }

    is(page, pageType) {
        this.validatePage(page);
        this.validatePageType(pageType);

        var propertyName = this.getPropertyName(pageType);
        return pageProperty.isTrue(page, propertyName);
    }

};

module.exports = PageType;
{'fraction_non_alphanumeric': 0.12470252260828177, 'fraction_numerical': 0.0019038553069966682, 'mean_word_length': 2.445901639344262, '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': '2206625', 'n_tokens_mistral': 590, 'n_tokens_neox': 577, 'n_words': 134}