<commit_before>import enforce from '../util/enforce';
import * as helpers from '../util/helpers';
import * as _ from 'underscore';

export class ModuleRepository {
    static lookup: Object = {};

    static addModule(name: string): ModuleBuilder {
        var module = {};

        ModuleRepository.lookup[name] = module;

        return new ModuleBuilder(module);
    }
}

class ModuleBuilder {
    constructor(private module: any) {
    }

    function(name: string, func: Function | any[]): ModuleBuilder {
        var f = new ModuleFunction(name, func);
        this.module[name] = f.declaration;

        return this;
    }

    export(): Object {
        return this.module;
    }
}

const AliasListKey = '__alias';
const DeferredListKey = '__deferEval';
const DeferredPrefix = '$deferred.';
class ModuleFunction {

    declaration: Function;

    constructor(
        public name: string,
        declaration: Function | any[]) {
        enforce(name, 'name')
            .isNotNull()
            .isString();
        enforce(declaration, 'declaration').isNotNull();

        const actualParams = helpers.getParameters(declaration);
        let funcArray: any[];<commit_msg>Added asExport for backward compatibility<commit_after>import enforce from '../util/enforce';
import * as helpers from '../util/helpers';
import * as _ from 'underscore';

export class ModuleRepository {
    static lookup: Object = {};

    static addModule(name: string): ModuleBuilder {
        var module = {};

        ModuleRepository.lookup[name] = module;

        return new ModuleBuilder(module);
    }
}

class ModuleBuilder {
    constructor(private module: any) {
    }

    function(name: string, func: Function | any[]): ModuleBuilder {
        var f = new ModuleFunction(name, func);
        this.module[name] = f.declaration;

        return this;
    }

    export(): Object {
        return this.module;
    }

    //Deprecated, added for backward compatibility
    asExport(): Object {
        return this.export();
    }
}

const AliasListKey = '__alias';
const DeferredListKey = '__deferEval';
const DeferredPrefix = '$deferred.';
class ModuleFunction {

    declaration: Function;

    constructor(
        public name: string,
        declaration: Function | any[]) {
        enforce(name, 'name')
            .isNotNull()
            .isString();
        enforce(declaration, 'declaration').isNotNull();

        const actualParams = helpers.getParameters(declaration);
        let funcArray: any[];
{'fraction_non_alphanumeric': 0.11656686626746507, 'fraction_numerical': 0.0, 'mean_word_length': 2.7291666666666665, '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': '4587517', 'n_tokens_mistral': 680, 'n_tokens_neox': 669, 'n_words': 184}