{"version":3,"sources":["../../src/math/sumBigDecimalBy.ts"],"sourcesContent":["import { BigDecimal } from './bigDecimal';\nimport { BigDecimals } from './BigDecimals';\n\n/**\n * Util function to sum BigDecimal values, inspired by Lodash\n * @param collection\n * @param iteratee\n */\nexport function sumBigDecimalBy<T>(\n  collection: T[] | null | undefined,\n  iteratee: (value: T) => BigDecimal.Value,\n): BigDecimal {\n  return (\n    collection?.reduce((total, item) => {\n      return total.plus(iteratee(item));\n    }, BigDecimals.ZERO) ?? BigDecimals.ZERO\n  );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,yBAA4B;AAOrB,SAAS,gBACd,YACA,UACY;AACZ,SACE,YAAY,OAAO,CAAC,OAAO,SAAS;AAClC,WAAO,MAAM,KAAK,SAAS,IAAI,CAAC;AAAA,EAClC,GAAG,+BAAY,IAAI,KAAK,+BAAY;AAExC;","names":[]}