refactor: convert home made helpers to rambda ones
[e-mobility-charging-stations-simulator.git] / src / charging-station / broadcast-channel / ChargingStationWorkerBroadcastChannel.ts
index 1a825e39186e3bc94178507917ff966cd99b3db5..cb152baf7fbfc8e75766a6f7313ca390ea19f1d8 100644 (file)
@@ -1,4 +1,5 @@
 import { secondsToMilliseconds } from 'date-fns'
+import { isEmpty } from 'rambda'
 
 import { BaseError, type OCPPError } from '../../exception/index.js'
 import {
@@ -36,13 +37,7 @@ import {
   type StopTransactionRequest,
   type StopTransactionResponse
 } from '../../types/index.js'
-import {
-  Constants,
-  convertToInt,
-  isAsyncFunction,
-  isEmptyObject,
-  logger
-} from '../../utils/index.js'
+import { Constants, convertToInt, isAsyncFunction, logger } from '../../utils/index.js'
 import type { ChargingStation } from '../ChargingStation.js'
 import { getConfigurationKey } from '../ConfigurationKeyUtils.js'
 import { buildMeterValue } from '../ocpp/index.js'
@@ -293,7 +288,7 @@ export class ChargingStationWorkerBroadcastChannel extends WorkerBroadcastChanne
     let responsePayload: BroadcastChannelResponsePayload | undefined
     this.commandHandler(command, requestPayload)
       .then(commandResponse => {
-        if (commandResponse == null || isEmptyObject(commandResponse)) {
+        if (commandResponse == null || isEmpty(commandResponse)) {
           responsePayload = {
             hashId: this.chargingStation.stationInfo?.hashId,
             status: ResponseStatus.SUCCESS
@@ -420,7 +415,7 @@ export class ChargingStationWorkerBroadcastChannel extends WorkerBroadcastChanne
         return ResponseStatus.FAILURE
       case BroadcastChannelProcedureName.STATUS_NOTIFICATION:
       case BroadcastChannelProcedureName.METER_VALUES:
-        if (isEmptyObject(commandResponse)) {
+        if (isEmpty(commandResponse)) {
           return ResponseStatus.SUCCESS
         }
         return ResponseStatus.FAILURE