<commit_before>const ee = require('ee')
const _ = require('lodash')

const filterTable = ({tableId, columnName, columnValue}) => {
    const table = ee.FeatureCollection(tableId)
    const filters = [ee.Filter.eq(columnName, columnValue)]
    if (_.isFinite(columnValue))
        filters.push(ee.Filter.eq(columnName, _.toNumber(columnValue)))
    return table
        .filter(ee.Filter.or(...filters))
}

module.exports = {
    filterTable
}<commit_msg>Returned whole EE table when no columnName is specified.<commit_after>const ee = require('ee')
const _ = require('lodash')

const filterTable = ({tableId, columnName, columnValue}) => {
    const table = ee.FeatureCollection(tableId)
    if (columnName) {
        const filters = [ee.Filter.eq(columnName, columnValue)]
        if (_.isFinite(columnValue))
            filters.push(ee.Filter.eq(columnName, _.toNumber(columnValue)))
        return table
            .filter(ee.Filter.or(...filters))
    } else {
        return table
    }
}

module.exports = {
    filterTable
}
{'fraction_non_alphanumeric': 0.1345595353339787, 'fraction_numerical': 0.0, 'mean_word_length': 3.3263598326359833, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4414023', 'n_tokens_mistral': 318, 'n_tokens_neox': 313, 'n_words': 65}