mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-15 12:20:31 +00:00
16 lines
471 B
TypeScript
16 lines
471 B
TypeScript
import { chain } from 'lodash';
|
|
|
|
/**
|
|
* Grpups by transaction type and id the inventory transactions.
|
|
* @param {IInventoryTransaction} invTransactions
|
|
* @returns
|
|
*/
|
|
export function groupInventoryTransactionsByTypeId(
|
|
transactions: { transactionType: string; transactionId: number }[]
|
|
): { transactionType: string; transactionId: number }[][] {
|
|
return chain(transactions)
|
|
.groupBy((t) => `${t.transactionType}-${t.transactionId}`)
|
|
.values()
|
|
.value();
|
|
}
|