Skip to content

Commit

Permalink
Diff method eslint refactoring done
Browse files Browse the repository at this point in the history
  • Loading branch information
HeeManSu committed Mar 12, 2024
1 parent 1eb260d commit 2a46726
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
4 changes: 4 additions & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,7 @@ export interface childProcessResponse {
type: keyof typeof protocol;
data: unknown;
}

export interface InspectObject {
[key: string]: Array<{ name: string }>;
}
18 changes: 8 additions & 10 deletions src/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import { NextFunction, Request, RequestHandler, Response } from 'express';
import {
createInstallDependenciesScript,
currentFile,
IAllApps
IAllApps,
InspectObject
} from '../constants';

export const dirName = (gitUrl: string): string =>
Expand Down Expand Up @@ -119,21 +120,18 @@ export const getLangId = (input: string): LanguageId => {
return extension as LanguageId;
};

//eslint-disable-next-line
export const diff = (object1: any, object2: any): any => {
export const diff = (
object1: InspectObject,
object2: InspectObject
): InspectObject => {
for (const key in object2) {
//eslint-disable-next-line
if (Array.isArray(object2[key])) {
//eslint-disable-next-line
object1[key] = object1[key].filter(
(
item: any // eslint-disable-line
) => !object2[key].find((i: any) => i.name === item.name) // eslint-disable-line
item => !object2[key].find(i => i.name === item.name)
);
}
}

return object1; // eslint-disable-line
return object1;
};

export function isIAllApps(data: any): data is IAllApps {
Expand Down

0 comments on commit 2a46726

Please sign in to comment.