Skip to content

Commit 5d77bc7

Browse files
committed
Generate translation migration file
- Remove unused files from utils/common
1 parent 3258b96 commit 5d77bc7

File tree

2 files changed

+747
-42
lines changed

2 files changed

+747
-42
lines changed

app/src/utils/common.ts

Lines changed: 1 addition & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
import { DEFAULT_INVALID_TEXT } from '@ifrc-go/ui/utils';
2-
import {
3-
isDefined,
4-
isNotDefined,
5-
isTruthyString,
6-
} from '@togglecorp/fujs';
2+
import { isTruthyString } from '@togglecorp/fujs';
73

84
import type { GoApiResponse } from '#utils/restRequest';
95

@@ -56,40 +52,3 @@ export function getFirstTruthyString(
5652

5753
return invalidText;
5854
}
59-
60-
// TODO: write tests for the function
61-
export function doArraysContainSameElements(
62-
newArray: unknown[] | undefined,
63-
oldArray: unknown[] | undefined,
64-
): boolean {
65-
if (isNotDefined(newArray) && isNotDefined(oldArray)) {
66-
return true;
67-
}
68-
if (isDefined(newArray) && isDefined(oldArray)) {
69-
if (newArray.length !== oldArray.length) {
70-
return false;
71-
}
72-
return newArray.every((id) => oldArray.includes(id));
73-
}
74-
return false;
75-
}
76-
77-
// TODO: write tests for the function
78-
export function flattenObject<T extends Record<string, unknown>>(
79-
inputObject: T,
80-
prefix?: string,
81-
): Record<string, unknown> {
82-
return Object.entries(inputObject).reduce((acc, [key, value]) => {
83-
const newKey = prefix ? `${prefix}.${key}` : key;
84-
if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
85-
return { ...acc, ...flattenObject(value as Record<string, unknown>, newKey) };
86-
}
87-
return { ...acc, [newKey]: value };
88-
}, {} as Record<string, unknown>);
89-
}
90-
91-
// TODO: write tests for the function
92-
export function getLastSegment(str: string, delimiter: string) {
93-
const parts = str.split(delimiter);
94-
return parts[parts.length - 1];
95-
}

0 commit comments

Comments
 (0)