diff --git a/src/importers/baseImporter.ts b/src/importers/baseImporter.ts index 67d9f3f62..a1196b587 100644 --- a/src/importers/baseImporter.ts +++ b/src/importers/baseImporter.ts @@ -155,7 +155,7 @@ export abstract class BaseImporter { } protected isNullOrWhitespace(str: string): boolean { - return str == null || typeof str !== 'string' || str.trim() === ''; + return Utils.isNullOrWhitespace(str); } protected getValueOrDefault(str: string, defaultValue: string = null): string { diff --git a/src/misc/utils.ts b/src/misc/utils.ts index 2c60a1a7a..c7f3eeccc 100644 --- a/src/misc/utils.ts +++ b/src/misc/utils.ts @@ -236,6 +236,10 @@ export class Utils { }; } + static isNullOrWhitespace(str: string): boolean { + return str == null || typeof str !== 'string' || str.trim() === ''; + } + private static validIpAddress(ipString: string): boolean { // tslint:disable-next-line const ipRegex = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/;