<commit_before>'use strict';

var expect = require('chai').expect;

function formatName(name, type) {

    var result = '#' + name;

    if (type === 'function') {

        result += '()';
    }

    return result;
}

function getMemberInfo(member) {

    if (Array.isArray(member) && member.length === 1) {

        member = member[0];
    }

    var hasType = Array.isArray(member) && member.length > 1;

    var memberName;
    var memberType;

    if (hasType) {

        memberName = member[0];
        memberType = member[1];

    } else {

        memberName = member;
    }

    return {
        hasType: hasType,
        name: memberName,
        type: memberType,
        formattedName: formatName(memberName, memberType)
    };
}

function getTitle(objectName, member) {

    var memberInfo = getMemberInfo(member);

    var message = '#' + objectName + ' should have property [' + (memberInfo.type || 'any') + '] ' + memberInfo.formattedName;

    return message;
}

function testMember(objectName, obj, member, multitest) {

    var memberInfo = getMemberInfo(member);

    var title = getTitle(objectName, member);

    function executeTest() {

        var member = obj[memberInfo.name];

        expect(member).to.exist;

        if (memberInfo.hasType) {

            expect(member).to.be.a(memberInfo.type);
        }
    }

    if (multitest) {

        it(title, executeTest);

    } else {

        executeTest();
    }
}

function assertComposition(multitest) {

    var that = Object.create(null);

    that.object = function (objectName, obj, members) {

        for (var i = 0; i < members.length; i += 1) {

            var member = members[i];

            testMember(objectName, obj, member, multitest);
        }
    };

    that.function = function (name, obj) {

        function executeTest() {

            expect(obj).to.be.a('function');
        }
<commit_msg>reversed the order of the assertComposition.function parameters so that the name argument becomes optional<commit_after>'use strict';

var expect = require('chai').expect;

function formatName(name, type) {

    var result = '#' + name;

    if (type === 'function') {

        result += '()';
    }

    return result;
}

function getMemberInfo(member) {

    if (Array.isArray(member) && member.length === 1) {

        member = member[0];
    }

    var hasType = Array.isArray(member) && member.length > 1;

    var memberName;
    var memberType;

    if (hasType) {

        memberName = member[0];
        memberType = member[1];

    } else {

        memberName = member;
    }

    return {
        hasType: hasType,
        name: memberName,
        type: memberType,
        formattedName: formatName(memberName, memberType)
    };
}

function getTitle(objectName, member) {

    var memberInfo = getMemberInfo(member);

    var message = '#' + objectName + ' should have property [' + (memberInfo.type || 'any') + '] ' + memberInfo.formattedName;

    return message;
}

function testMember(objectName, obj, member, multitest) {

    var memberInfo = getMemberInfo(member);

    var title = getTitle(objectName, member);

    function executeTest() {

        var member = obj[memberInfo.name];

        expect(member).to.exist;

        if (memberInfo.hasType) {

            expect(member).to.be.a(memberInfo.type);
        }
    }

    if (multitest) {

        it(title, executeTest);

    } else {

        executeTest();
    }
}

function assertComposition(multitest) {

    var that = Object.create(null);

    that.object = function (objectName, obj, members) {

        for (var i = 0; i < members.length; i += 1) {

            var member = members[i];

            testMember(objectName, obj, member, multitest);
        }
    };

    that.function = function (obj, name) {

        function executeTest() {

            expect(obj).to.be.a('function');
        }

{'fraction_non_alphanumeric': 0.12953901622456862, 'fraction_numerical': 0.0036054596961112542, 'mean_word_length': 2.322497861420017, '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': '2553577', 'n_tokens_mistral': 1226, 'n_tokens_neox': 1150, 'n_words': 271}