Skip to content
This repository has been archived by the owner on Jun 17, 2022. It is now read-only.

Commit

Permalink
null or whitespace util
Browse files Browse the repository at this point in the history
  • Loading branch information
kspearrin committed Jan 15, 2019
1 parent f4c4f28 commit cb7336c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/importers/baseImporter.ts
Expand Up @@ -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 {
Expand Down
4 changes: 4 additions & 0 deletions src/misc/utils.ts
Expand Up @@ -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]?)$/;
Expand Down

0 comments on commit cb7336c

Please sign in to comment.