<commit_before>'use strict';

class Locator {

    /**
     * @param {config} config
     * @param {{}} locatableConfig
     * @param {string} relativePathModifierToRoot eg '../../' if the locator is one folder deep from the root
     */
    constructor(config, locatableConfig, relativePathModifierToRoot) {
        this._config = config;
        this._locatableConfig = locatableConfig;
        this._relativePathModifierToRoot = relativePathModifierToRoot || '../../';

        this._locatable = {};

        this._reservedCharacters = ['%', '@', '~'];
    }

    /**
     * @param {string} name
     * @returns {object}
     */
    get(name) {
        //there is already an instance
        if (this._locatable[name] !== undefined) {
            return this._locatable[name];
        }

        //there is no locatable config, throw an error
        if (this._locatableConfig[name] === undefined) {
            throw new Error('Could not retrieve an instance for ' + name);
        }

        //it's an alias, return the referenced object
        if (typeof this._locatableConfig[name] === 'string') {
            this._locatable[name] = this.get(this._locatableConfig[name]);
            return this._locatable[name];
        }

        //create an instance based on the configuration
        this._locatable[name] = this._createInstance(this._locatableConfig[name]);
        return this._locatable[name];
    }

    /**
     * @param {string} requirable
     * @returns {object}
     * @private
     */
    /**
     * @param {string} requirable
     * @returns {object}<commit_msg>Removed duplicate docblock for the _require method<commit_after>'use strict';

class Locator {

    /**
     * @param {config} config
     * @param {{}} locatableConfig
     * @param {string} relativePathModifierToRoot eg '../../' if the locator is one folder deep from the root
     */
    constructor(config, locatableConfig, relativePathModifierToRoot) {
        this._config = config;
        this._locatableConfig = locatableConfig;
        this._relativePathModifierToRoot = relativePathModifierToRoot || '../../';

        this._locatable = {};

        this._reservedCharacters = ['%', '@', '~'];
    }

    /**
     * @param {string} name
     * @returns {object}
     */
    get(name) {
        //there is already an instance
        if (this._locatable[name] !== undefined) {
            return this._locatable[name];
        }

        //there is no locatable config, throw an error
        if (this._locatableConfig[name] === undefined) {
            throw new Error('Could not retrieve an instance for ' + name);
        }

        //it's an alias, return the referenced object
        if (typeof this._locatableConfig[name] === 'string') {
            this._locatable[name] = this.get(this._locatableConfig[name]);
            return this._locatable[name];
        }

        //create an instance based on the configuration
        this._locatable[name] = this._createInstance(this._locatableConfig[name]);
        return this._locatable[name];
    }

    /**
     * @param {string} requirable
     * @returns {object}
{'fraction_non_alphanumeric': 0.12724358974358974, 'fraction_numerical': 0.0, 'mean_word_length': 2.299154334038055, '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': '2909726', 'n_tokens_mistral': 855, 'n_tokens_neox': 843, 'n_words': 213}