UNPKG

@tidyjs/tidy

Version:

Tidy up your data with JavaScript, inspired by dplyr and the tidyverse

23 lines (18 loc) 684 B
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var arrange = require('./arrange.js'); var groupBy = require('./groupBy.js'); var identity = require('./helpers/identity.js'); var tally = require('./tally.js'); var tidy = require('./tidy.js'); function count(groupKeys, options) { const _count = (items) => { options = options != null ? options : {}; const {name = "n", sort} = options; const results = tidy.tidy(items, groupBy.groupBy(groupKeys, [tally.tally(options)]), sort ? arrange.arrange(arrange.desc(name)) : identity.identity); return results; }; return _count; } exports.count = count; //# sourceMappingURL=count.js.map