<commit_before>var React = require('../deps/react');
var dateFormat = require('../util').dateFormat;

var PurposeComponent = React.createClass({
    displayName: 'PurposeComponent',
    getInitialState : function() {
        return {
            hidePurposes : true
        }
    },
    getList : function() {
//        var list = [];
        // clean items
//        for (var i in this.props.purpose.items) {
//            var item = this.props.purpose.items[i];
//            if (item) {
//                list.push(item);
//            }
//        }
        // then add empty
        return this.props.purpose.items.concat(['']);
    },
    render : function() {
        var date = this.props.date;
        var that = this;
        var list = this.getList();
        return React.DOM.div({
                className : 'center',
                style : {
                    'margin-top' : '10px'
                }
            },
            React.DOM.span({
                onClick : function() {
                    if (date.toDateString() !== new Date().toDateString()) {
                        var state = {
                            hidePurposes : !this.state.hidePurposes
                        };
                        this.setState(state);
                    }
                }.bind(this)
            }, date.toDateString() !== new Date().toDateString() && this.state.hidePurposes ? 'Show purposes >' : 'Purposes:'),
            React.DOM.br(),
            React.DOM.ul({
                    style : {
                        padding : '0',
                        margin : '0',
                        display : date.toDateString() !== new Date().toDateString() && this.state.hidePurposes ? 'none' : ''
                    }
                },
                list.map(function(item, index) {
                    return React.DOM.li({
                            key : that.props.purpose.key + index,
                            style : {
                                margin : '2px'
                            }
                        },
                        React.DOM.input({
                            style : {
                                width : '100%'
                            },
                            className : 'topcoat-text-input',
                            value : item,
                            onChange : function(e) {
                                that.props.purpose.items[index] = e.target.value;
                                that.props.updatePurpose(that.props.purpose);
                            }
                        }),
                        React.DOM.br()
                    )
                })
            )
        );
    }
});

module.exports = PurposeComponent;<commit_msg>`Enter` as `Tab` for input list<commit_after>var React = require('../deps/react');
var dateFormat = require('../util').dateFormat;

var PurposeComponent = React.createClass({
    displayName: 'PurposeComponent',
    getInitialState : function() {
        return {
            hidePurposes : true
        }
    },
    getList : function() {
//        var list = [];
        // clean items
//        for (var i in this.props.purpose.items) {
//            var item = this.props.purpose.items[i];
//            if (item) {
//                list.push(item);
//            }
//        }
        // then add empty
        return this.props.purpose.items.concat(['']);
    },
    render : function() {
        var date = this.props.date;
        var that = this;
        var list = this.getList();
        return React.DOM.div({
                className : 'center',
                style : {
                    'margin-top' : '10px'
                }
            },
            React.DOM.span({
                onClick : function() {
                    if (date.toDateString() !== new Date().toDateString()) {
                        var state = {
                            hidePurposes : !this.state.hidePurposes
                        };
                        this.setState(state);
                    }
                }.bind(this)
            }, date.toDateString() !== new Date().toDateString() && this.state.hidePurposes ? 'Show purposes >' : 'Purposes:'),
            React.DOM.br(),
            React.DOM.ul({
                    style : {
                        padding : '0',
                        margin : '0',
                        display : date.toDateString() !== new Date().toDateString() && this.state.hidePurposes ? 'none' : ''
                    }
                },
                list.map(function(item, index) {
                    return React.DOM.li({
                            key : that.props.purpose.key + index,
                            style : {
                                margin : '2px'
                            }
                        },
                        React.DOM.input({
                            style : {
                                width : '100%'
                            },
                            className : 'topcoat-text-input',
                            value : item,
                            onChange : function(e) {
                                that.props.purpose.items[index] = e.target.value;
                                that.props.updatePurpose(that.props.purpose);
                            },
                            onKeyPress : function(e) {
                                if (e.which == 13) {
                                    // focus next input
                                    e.target.parentElement.nextSibling.children[0].focus();
                                    e.preventDefault();
                                }
                            }
                        })
                    )
                })
            )
        );
    }
});

module.exports = PurposeComponent;
{'fraction_non_alphanumeric': 0.11722610325438745, 'fraction_numerical': 0.0032373487817345375, 'mean_word_length': 0.8488188976377953, 'pattern_counts': {'":': 0, '<': 3, '<?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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6792833', 'n_tokens_mistral': 1444, 'n_tokens_neox': 1350, 'n_words': 243}