{"size": 552, "ext": "js", "max_stars_repo_path": "src/api/data/queries/column.js", "max_stars_repo_name": "wagnerjt/halin", "max_stars_repo_stars_event_min_datetime": "2018-10-11T10:54:03.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-27T10:56:33.000Z", "max_issues_repo_path": "src/api/data/queries/column.js", "max_issues_repo_name": "wagnerjt/halin", "max_issues_repo_issues_event_min_datetime": "2018-09-19T22:18:46.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-03T12:41:29.000Z", "max_forks_repo_path": "src/api/data/queries/column.js", "max_forks_repo_name": "wagnerjt/halin", "max_forks_repo_forks_event_min_datetime": "2018-11-08T07:47:26.000Z", "max_forks_repo_forks_event_max_datetime": "2021-09-29T23:54:08.000Z"}
{"max_stars_count": 82, "max_issues_count": 152, "max_forks_count": 23, "avg_line_length": 22.08, "max_line_length": 84, "alphanum_fraction": 0.5996376812}
/**
 * Convenience functions for dealing with columns expected back from Cypher queries.
 */
import _ from 'lodash';

const column = data => {
    let col;

    if (typeof data === 'string') {
        col = { accessor: data };
    } else {
        col = _.cloneDeep(data);
    }

    if (!col.Header) {
        col.Header = col.accessor.charAt(0).toUpperCase() + col.accessor.slice(1)
    }

    // The Cell function is what react-table and other plugins use
    col.renderWith = f => _.set(col, 'Cell', f);

    return col;
};

 export default column;