Package:
@hexos/commonSums a numeric property across an array of objects in a type-safe manner.
Only accepts properties that are of type number, enforced at the type level via
the OnlyNumerics mapped type. Handles null and undefined arrays gracefully by
treating them as empty.
Example
const orders = [{ total: 10 }, { total: 25 }, { total: 5 }];
summate(orders, 'total'); // => 40function summate<T extends OnlyNumerics<T>>(items: T[] | undefined | null, prop: keyof OnlyNumerics<T>): numberParameters
items
T[] | undefined | nullprop
keyof OnlyNumerics