arquero
Version:
Query processing and transformation of array-backed data tables.
14 lines (12 loc) • 463 B
JavaScript
import { isFunction } from '../../util/is-function.js';
/**
* Return a potentially filtered list of column names.
* @param {import('../../table/Table.js').Table} table A data table.
* @param {import('../types.js').ColumnSelectOptions} names The column names to select.
* @returns {string[]} The selected column names.
*/
export function columns(table, names) {
// @ts-ignore
return isFunction(names) ? names(table)
: names || table.columnNames();
}