<commit_before>import React from 'react';
import {stitch, compose, memoize, objectAssign} from '../../src/keo';

/**
 * @method findHuman
 * @return {Object}
 */
export const findHuman = () => {
    const name = 'Jeremiah';
    return { name, lifeRemaining: randomLife(),
             current: `We have ${name} in our grips, but he is resisting our advances.` };
};

/**
 * @method eatBrain
 * @param {Object} name
 * @return {Object}
 */
export const eatBrain = name => {
    return { name: '', current: `${name} is now tiring. Eating brain... Nom, nom, nom!`, lifeRemaining: 0 };
};

/**
 * @method capitaliseName
 * @param {String} name
 * @return {String}
 */
export const capitaliseName = memoize(name => {
    return name.toUpperCase();
});

/**
 * @method randomLife
 * @return {Number}
 */
export const randomLife = () => {
    return Math.floor(Math.random() * 10) + 1;
};

/**
 * @method hasBrain
 * @param {Object} args
 * @return {Object}
 */
const hasBrain = args => {

    const brainIntact = args.state.lifeRemaining > 0;

    return objectAssign({}, args, {
        state: { ...args.state, brainIntact }
    });

};

/**
 * @method componentWillMount
 * @param {Function} setState
 * @return {void}
 */
const componentWillMount = ({ setState }) => {
    setState({ lifeRemaining: randomLife() });
};

/**
 * @method render
 * @param {Object} props
 * @param {Object} state
 * @param {Function} setState
 * @return {XML}
 */
const render = compose(hasBrain, ({ props, state, setState, dispatch }) => {

    const setNameAndDispatch = compose(
        state => setState(state),
        emit  => dispatch(emit)
    );

    return (
        <article>
            <h1>Señorita Zombie {capitaliseName(props.name)}</h1>
            <h2>Human Brain Intact: { state.brainIntact ? 'Kinda!' : 'Auf Wiedersehen, Brain.' }</h2>
            <button onClick={() => setState(findHuman())}>Find Human</button>
            <button onClick={() => setNameAndDispatch(eatBrain(state.name))} disabled={!state.name}>Eat Brain</button>
        </article><commit_msg>Changed name of argument for dispatch<commit_after>import React from 'react';
import {stitch, compose, memoize, objectAssign} from '../../src/keo';

/**
 * @method findHuman
 * @return {Object}
 */
export const findHuman = () => {
    const name = 'Jeremiah';
    return { name, lifeRemaining: randomLife(),
             current: `We have ${name} in our grips, but he is resisting our advances.` };
};

/**
 * @method eatBrain
 * @param {Object} name
 * @return {Object}
 */
export const eatBrain = name => {
    return { name: '', current: `${name} is now tiring. Eating brain... Nom, nom, nom!`, lifeRemaining: 0 };
};

/**
 * @method capitaliseName
 * @param {String} name
 * @return {String}
 */
export const capitaliseName = memoize(name => {
    return name.toUpperCase();
});

/**
 * @method randomLife
 * @return {Number}
 */
export const randomLife = () => {
    return Math.floor(Math.random() * 10) + 1;
};

/**
 * @method hasBrain
 * @param {Object} args
 * @return {Object}
 */
const hasBrain = args => {

    const brainIntact = args.state.lifeRemaining > 0;

    return objectAssign({}, args, {
        state: { ...args.state, brainIntact }
    });

};

/**
 * @method componentWillMount
 * @param {Function} setState
 * @return {void}
 */
const componentWillMount = ({ setState }) => {
    setState({ lifeRemaining: randomLife() });
};

/**
 * @method render
 * @param {Object} props
 * @param {Object} state
 * @param {Function} setState
 * @return {XML}
 */
const render = compose(hasBrain, ({ props, state, setState, dispatch }) => {

    const setNameAndDispatch = compose(
        state => setState(state),
        event => dispatch(event)
    );

    return (
        <article>
            <h1><NAME> {capitaliseName(props.name)}</h1>
            <h2>Human Brain Intact: { state.brainIntact ? 'Kinda!' : 'Auf Wiedersehen, Brain.' }</h2>
            <button onClick={() => setState(findHuman())}>Find Human</button>
            <button onClick={() => setNameAndDispatch(eatBrain(state.name))} disabled={!state.name}>Eat Brain</button>
        </article>
{'fraction_non_alphanumeric': 0.17231364956437561, 'fraction_numerical': 0.004356243949661181, 'mean_word_length': 3.133, 'pattern_counts': {'":': 0, '<': 24, '<?xml version=': 0, '>': 48, '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': '2332888', 'n_tokens_mistral': 1337, 'n_tokens_neox': 1295, 'n_words': 345}