X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcharging-station%2FConfigurationKeyUtils.ts;h=72fb88d757ba93565cd6b93574a5914141190a4b;hb=b13beb880ee7647456c703b93657a42c3ec2e5ee;hp=044c09230b85c9e1ee01ecd41b8fe37be2cc5183;hpb=66a7748ddeda8c94d7562a1ce58d440319654a4c;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/ConfigurationKeyUtils.ts b/src/charging-station/ConfigurationKeyUtils.ts index 044c0923..72fb88d7 100644 --- a/src/charging-station/ConfigurationKeyUtils.ts +++ b/src/charging-station/ConfigurationKeyUtils.ts @@ -46,13 +46,13 @@ export const addConfigurationKey = ( } params = { ...{ overwrite: false, save: false }, ...params } let keyFound = getConfigurationKey(chargingStation, key) - if (keyFound !== undefined && params?.overwrite === true) { + if (keyFound != null && params?.overwrite === true) { deleteConfigurationKey(chargingStation, keyFound.key, { save: false }) keyFound = undefined } - if (keyFound === undefined) { + if (keyFound == null) { chargingStation.ocppConfiguration?.configurationKey?.push({ key, // eslint-disable-next-line @typescript-eslint/no-non-null-assertion @@ -77,7 +77,7 @@ export const setConfigurationKeyValue = ( caseInsensitive = false ): void => { const keyFound = getConfigurationKey(chargingStation, key, caseInsensitive) - if (keyFound !== undefined) { + if (keyFound != null) { // eslint-disable-next-line @typescript-eslint/no-non-null-assertion chargingStation.ocppConfiguration!.configurationKey![ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion @@ -99,7 +99,7 @@ export const deleteConfigurationKey = ( ): ConfigurationKey[] | undefined => { params = { ...{ save: true, caseInsensitive: false }, ...params } const keyFound = getConfigurationKey(chargingStation, key, params?.caseInsensitive) - if (keyFound !== undefined) { + if (keyFound != null) { const deletedConfigurationKey = chargingStation.ocppConfiguration?.configurationKey?.splice( chargingStation.ocppConfiguration.configurationKey.indexOf(keyFound), 1