-
- // private static isObject(item: unknown): boolean {
- // return item && typeof item === 'object' && Array.isArray(item) === false;
- // }
-
- private static objectHasOwnProperty(object: unknown, property: string): boolean {
- return Object.prototype.hasOwnProperty.call(object, property) as boolean;
- }
-
- private static isUndefined(obj: unknown): boolean {
- return typeof obj === 'undefined';
- }
-
- private static merge(target: object, ...sources: object[]): object {
- return merge(target, ...sources);
- }
-
- private static handleFileException(
- logPrefix: string,
- fileType: FileType,
- filePath: string,
- error: NodeJS.ErrnoException,
- params: HandleErrorParams<EmptyObject> = { throwError: true }
- ): void {
- const prefix = logPrefix.length !== 0 ? logPrefix + ' ' : '';
- if (error.code === 'ENOENT') {
- console.error(
- chalk.green(prefix) + chalk.red(fileType + ' file ' + filePath + ' not found: '),
- error
- );
- } else if (error.code === 'EEXIST') {
- console.error(
- chalk.green(prefix) + chalk.red(fileType + ' file ' + filePath + ' already exists: '),
- error
- );
- } else if (error.code === 'EACCES') {
- console.error(
- chalk.green(prefix) + chalk.red(fileType + ' file ' + filePath + ' access denied: '),
- error
- );
- } else {
- console.error(
- chalk.green(prefix) + chalk.red(fileType + ' file ' + filePath + ' error: '),
- error
- );
- }
- if (params?.throwError) {
- throw error;
- }
- }