connectorId?: number
): boolean {
const reservation = this.getReservationBy('reservationId', reservationId)
- const reservationExists = reservation !== undefined && !hasReservationExpired(reservation)
+ const reservationExists = reservation != null && !hasReservationExpired(reservation)
if (arguments.length === 1) {
return !reservationExists
} else if (arguments.length > 1) {
- const userReservation =
- idTag !== undefined ? this.getReservationBy('idTag', idTag) : undefined
+ const userReservation = idTag != null ? this.getReservationBy('idTag', idTag) : undefined
const userReservationExists =
- userReservation !== undefined && !hasReservationExpired(userReservation)
- const notConnectorZero = connectorId === undefined ? true : connectorId > 0
+ userReservation != null && !hasReservationExpired(userReservation)
+ const notConnectorZero = connectorId == null ? true : connectorId > 0
const freeConnectorsAvailable = this.getNumberOfReservableConnectors() > 0
return (
!reservationExists && !userReservationExists && notConnectorZero && freeConnectorsAvailable
const chargingStationInfo = {
chargePointModel: stationTemplate.chargePointModel,
chargePointVendor: stationTemplate.chargePointVendor,
- ...(stationTemplate.chargeBoxSerialNumberPrefix !== undefined && {
+ ...(stationTemplate.chargeBoxSerialNumberPrefix != null && {
chargeBoxSerialNumber: stationTemplate.chargeBoxSerialNumberPrefix
}),
- ...(stationTemplate.chargePointSerialNumberPrefix !== undefined && {
+ ...(stationTemplate.chargePointSerialNumberPrefix != null && {
chargePointSerialNumber: stationTemplate.chargePointSerialNumberPrefix
}),
- ...(stationTemplate.meterSerialNumberPrefix !== undefined && {
+ ...(stationTemplate.meterSerialNumberPrefix != null && {
meterSerialNumber: stationTemplate.meterSerialNumberPrefix
}),
- ...(stationTemplate.meterType !== undefined && {
+ ...(stationTemplate.meterType != null && {
meterType: stationTemplate.meterType
})
}
return {
chargePointModel: stationInfo.chargePointModel,
chargePointVendor: stationInfo.chargePointVendor,
- ...(stationInfo.chargeBoxSerialNumber !== undefined && {
+ ...(stationInfo.chargeBoxSerialNumber != null && {
chargeBoxSerialNumber: stationInfo.chargeBoxSerialNumber
}),
- ...(stationInfo.chargePointSerialNumber !== undefined && {
+ ...(stationInfo.chargePointSerialNumber != null && {
chargePointSerialNumber: stationInfo.chargePointSerialNumber
}),
- ...(stationInfo.firmwareVersion !== undefined && {
+ ...(stationInfo.firmwareVersion != null && {
firmwareVersion: stationInfo.firmwareVersion
}),
- ...(stationInfo.iccid !== undefined && { iccid: stationInfo.iccid }),
- ...(stationInfo.imsi !== undefined && { imsi: stationInfo.imsi }),
- ...(stationInfo.meterSerialNumber !== undefined && {
+ ...(stationInfo.iccid != null && { iccid: stationInfo.iccid }),
+ ...(stationInfo.imsi != null && { imsi: stationInfo.imsi }),
+ ...(stationInfo.meterSerialNumber != null && {
meterSerialNumber: stationInfo.meterSerialNumber
}),
- ...(stationInfo.meterType !== undefined && {
+ ...(stationInfo.meterType != null && {
meterType: stationInfo.meterType
})
} satisfies OCPP16BootNotificationRequest
chargingStation: {
model: stationInfo.chargePointModel,
vendorName: stationInfo.chargePointVendor,
- ...(stationInfo.firmwareVersion !== undefined && {
+ ...(stationInfo.firmwareVersion != null && {
firmwareVersion: stationInfo.firmwareVersion
}),
- ...(stationInfo.chargeBoxSerialNumber !== undefined && {
+ ...(stationInfo.chargeBoxSerialNumber != null && {
serialNumber: stationInfo.chargeBoxSerialNumber
}),
- ...((stationInfo.iccid !== undefined || stationInfo.imsi !== undefined) && {
+ ...((stationInfo.iccid != null || stationInfo.imsi != null) && {
modem: {
- ...(stationInfo.iccid !== undefined && { iccid: stationInfo.iccid }),
- ...(stationInfo.imsi !== undefined && { imsi: stationInfo.imsi })
+ ...(stationInfo.iccid != null && { iccid: stationInfo.iccid }),
+ ...(stationInfo.imsi != null && { imsi: stationInfo.imsi })
}
})
}
templateKey.deprecatedKey,
logPrefix,
templateFile,
- templateKey.key !== undefined ? `Use '${templateKey.key}' instead` : undefined
+ templateKey.key != null ? `Use '${templateKey.key}' instead` : undefined
)
convertDeprecatedTemplateKey(stationTemplate, templateKey.deprecatedKey, templateKey.key)
}
templateFile: string,
logMsgToAppend = ''
): void => {
- if (template[key as keyof ChargingStationTemplate] !== undefined) {
+ if (template[key as keyof ChargingStationTemplate] != null) {
const logMsg = `Deprecated template key '${key}' usage in file '${templateFile}'${
isNotEmptyString(logMsgToAppend) ? `. ${logMsgToAppend}` : ''
}`
deprecatedKey: string,
key?: string
): void => {
- if (template[deprecatedKey as keyof ChargingStationTemplate] !== undefined) {
- if (key !== undefined) {
+ if (template[deprecatedKey as keyof ChargingStationTemplate] != null) {
+ if (key != null) {
(template as unknown as Record<string, unknown>)[key] =
template[deprecatedKey as keyof ChargingStationTemplate]
}
public static getSupervisionUrls (): string | string[] | undefined {
if (
- Configuration.getConfigurationData()?.['supervisionURLs' as keyof ConfigurationData] !==
- undefined
+ Configuration.getConfigurationData()?.['supervisionURLs' as keyof ConfigurationData] != null
) {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
Configuration.getConfigurationData()!.supervisionUrls = Configuration.getConfigurationData()![
undefined,
"Use 'stationTemplateUrls' instead"
)
- Configuration.getConfigurationData()?.['stationTemplateURLs' as keyof ConfigurationData] !==
- undefined &&
+ Configuration.getConfigurationData()?.['stationTemplateURLs' as keyof ConfigurationData] !=
+ null &&
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
(Configuration.getConfigurationData()!.stationTemplateUrls =
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
Configuration.getConfigurationData()?.stationTemplateUrls.forEach(
(stationTemplateUrl: StationTemplateUrl) => {
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
- if (stationTemplateUrl['numberOfStation' as keyof StationTemplateUrl] !== undefined) {
+ if (stationTemplateUrl['numberOfStation' as keyof StationTemplateUrl] != null) {
console.error(
`${chalk.green(logPrefix())} ${chalk.red(
`Deprecated configuration key 'numberOfStation' usage for template file '${stationTemplateUrl.file}' in 'stationTemplateUrls'. Use 'numberOfStations' instead`
): void {
if (
sectionName != null &&
- Configuration.getConfigurationData()?.[sectionName as keyof ConfigurationData] !==
- undefined &&
+ Configuration.getConfigurationData()?.[sectionName as keyof ConfigurationData] != null &&
(
Configuration.getConfigurationData()?.[sectionName as keyof ConfigurationData] as Record<
string,
unknown
>
- )[key] !== undefined
+ )[key] != null
) {
console.error(
`${chalk.green(logPrefix())} ${chalk.red(
}`
)}`
)
- } else if (
- Configuration.getConfigurationData()?.[key as keyof ConfigurationData] !== undefined
- ) {
+ } else if (Configuration.getConfigurationData()?.[key as keyof ConfigurationData] != null) {
console.error(
`${chalk.green(logPrefix())} ${chalk.red(
`Deprecated configuration key '${key}' usage${
)
delete Configuration.configurationData
Configuration.configurationSectionCache.clear()
- if (Configuration.configurationChangeCallback !== undefined) {
+ if (Configuration.configurationChangeCallback != null) {
Configuration.configurationChangeCallback()
.catch(error => {
throw typeof error === 'string' ? new Error(error) : error