@tidyjs/tidy
Version:
Tidy up your data with JavaScript, inspired by dplyr and the tidyverse
19 lines (16 loc) • 567 B
JavaScript
import { arrange, desc } from './arrange.js';
import { groupBy } from './groupBy.js';
import { identity } from './helpers/identity.js';
import { tally } from './tally.js';
import { tidy } from './tidy.js';
function count(groupKeys, options) {
const _count = (items) => {
options = options != null ? options : {};
const {name = "n", sort} = options;
const results = tidy(items, groupBy(groupKeys, [tally(options)]), sort ? arrange(desc(name)) : identity);
return results;
};
return _count;
}
export { count };
//# sourceMappingURL=count.js.map