Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
udamir committed Dec 25, 2023
1 parent d01d881 commit 1bdb583
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@ export const popValues = (data: Record<string, unknown>, keys: string[]): Record
return source
}

export const removeDuplicates = <T>(array: T[]): T[] => {
const uniqueItems: T[] = [];
// export const removeDuplicates = <T>(array: T[]): T[] => {
// const uniqueItems: T[] = [];

for (const item of array) {
if (!uniqueItems.some((uniqueItem) => isEqual(uniqueItem, item))) {
uniqueItems.push(item);
}
}
// for (const item of array) {
// if (!uniqueItems.some((uniqueItem) => isEqual(uniqueItem, item))) {
// uniqueItems.push(item);
// }
// }

return uniqueItems;
}
// return uniqueItems;
// }

export const mergeValues = (value: any, patch: any) => {
if (Array.isArray(value) && Array.isArray(patch)) {
Expand Down Expand Up @@ -83,11 +83,11 @@ export const createRef = (basePath?: string, pointer?: string): string => {
}
}

export const resolveRefNode = (data: any, node: any) => {
const { $ref, ...rest } = node
const _ref = parseRef($ref)
return !_ref.filePath ? resolvePointer(data, _ref.pointer) : undefined
}
// export const resolveRefNode = (data: any, node: any) => {
// const { $ref, ...rest } = node
// const _ref = parseRef($ref)
// return !_ref.filePath ? resolvePointer(data, _ref.pointer) : undefined
// }

export const resolvePointer = (data: unknown, pointer: string, pointers: string[] = [pointer]): any => {
if (!isObject(data)) { return }
Expand Down

0 comments on commit 1bdb583

Please sign in to comment.