From 98ab19c6faa70f46ad6a469438c11e80f39c78c3 Mon Sep 17 00:00:00 2001 From: Dev Date: Wed, 8 Nov 2023 09:51:15 +0000 Subject: [PATCH] Update `countAllInsuranceItems()` to make use of `MathUtil.arraySum()` --- project/src/controllers/InsuranceController.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/project/src/controllers/InsuranceController.ts b/project/src/controllers/InsuranceController.ts index d281893d..7f85703f 100644 --- a/project/src/controllers/InsuranceController.ts +++ b/project/src/controllers/InsuranceController.ts @@ -26,6 +26,7 @@ import { MailSendService } from "@spt-aki/services/MailSendService"; import { PaymentService } from "@spt-aki/services/PaymentService"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; +import { MathUtil } from "@spt-aki/utils/MathUtil"; @injectable() export class InsuranceController @@ -35,6 +36,7 @@ export class InsuranceController constructor( @inject("WinstonLogger") protected logger: ILogger, @inject("RandomUtil") protected randomUtil: RandomUtil, + @inject("MathUtil") protected mathUtil: MathUtil, @inject("EventOutputHolder") protected eventOutputHolder: EventOutputHolder, @inject("TimeUtil") protected timeUtil: TimeUtil, @inject("SaveServer") protected saveServer: SaveServer, @@ -144,7 +146,7 @@ export class InsuranceController */ protected countAllInsuranceItems(insurance: Insurance[]): number { - return insurance.map(ins => ins.items.length).reduce((acc, len) => acc + len, 0); + return this.mathUtil.arraySum(insurance.map(ins => ins.items.length)); } /**