Collections
Lookup, grouping, and projection over arrays of objects:
findBy, where, pluck, keyBy, groupBy, countBy,
partition. Read more →
npm install op-arrayCollections
Lookup, grouping, and projection over arrays of objects:
findBy, where, pluck, keyBy, groupBy, countBy,
partition. Read more →
Logical
Predicates over membership and presence: exists, existsAll,
existsAny. Read more →
Numerical
Aggregations and statistics: sum, product, average,
median, mode, subtract. Read more →
Positional
Index- and position-based selection: first, last, nth,
minBy, maxBy. Read more →
Transformations
Pure shape changes and folds: unique, chunk, flatten,
intersection, and friends. Read more →
Tree-shakable
Each category publishes a subpath
(op-array/collections, op-array/numerical, …) so bundlers
only ship what you import.
Array.prototype mutation; nothing
monkey-patched.key resolves it
as a dot-delimited path (e.g. 'user.name').import { groupBy, pluck } from 'op-array/collections';import { average } from 'op-array/numerical';
const orders = [ { id: 1, customer: 'ana', total: 19 }, { id: 2, customer: 'bo', total: 42 }, { id: 3, customer: 'ana', total: 11 },];
groupBy(orders, 'customer');// { ana: [...], bo: [...] }
average(pluck(orders, 'total'));// 24