<commit_before>class Container{
    constructor(){
        this.services = {};
    }

    destroy(){
        delete this.services;
        this.services = {};
    }

    /**
     * Defines a service on the container. The service is accessed
     * directly as a property, but is not actually instantiated
     * before it is called.
     *
     * The service is only instantiated once.
     */
    service(name, cb){
        Object.defineProperty(this, name, {
            get: () => {
                if(!this.services.hasOwnProperty(name)){
                    this.services[name] = cb(this);
                }

                return this.services[name];
            }
        });

        return this;
    }

    /**
     * Define a factory function on the container.
     * The factory is accessed directly as a property,
     * and is instantiated every time the property is used.
     */
    factory(name, cb){
        Object.defineProperty(this, name, {
            get: () => {
                return cb(this);
            }
        });

        return this;
    }

    /**
     * A service provider is a class that uses
     * a register function to register all its related dependencies.
     * The container is passed to this function when the provider
     * registers itself here.
     */
    register(provider){
        provider.register(this);
    }

    /**
     * Helper function for binding constructor arguments.
     *
     * We also need it in order to set static properties to the bound constructor,
     * since React expects to get those directly from the element type.
     *
     * And lastly, we don't need to pass props and context to the Component,
     * since those are also set after React has constructed the component.
     * Admittedly, this should be done, but is not strictly necessary.
     */
    bindElement(elem, ...args){
        let f = elem.bind(null, ...args);

        /*
         Need to change the display name so we get something
         better than "bound something something"
        */
        f.displayName = elem.name;

        /*
        Also need to set various other static properties
         */
        f.defaultProps = elem.defaultProps;
        f.propTypes = elem.propTypes;
        f.contextTypes = elem.contextTypes;
        f.childContextTypes = elem.childContextTypes;

        return f;
    }
}

module.exports = Container;<commit_msg>Remove old stuff that's not really needed<commit_after>class Container{
    constructor(){
        this.services = {};
    }

    /**
     * Defines a service on the container. The service is accessed
     * directly as a property, but is not actually instantiated
     * before it is called.
     *
     * The service is only instantiated once.
     */
    service(name, cb){
        Object.defineProperty(this, name, {
            get: () => {
                if(!this.services.hasOwnProperty(name)){
                    this.services[name] = cb(this);
                }

                return this.services[name];
            },
            configurable: true,
            enumerable: true
        });

        return this;
    }
}

module.exports = Container;
{'fraction_non_alphanumeric': 0.08999052731291443, 'fraction_numerical': 0.0, 'mean_word_length': 1.7523892267593397, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, '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': '7673891', 'n_tokens_mistral': 817, 'n_tokens_neox': 787, 'n_words': 278}