diff --git a/src/frontend/src/utils.ts b/src/frontend/src/utils.ts index 2b488d54e..863d907da 100644 --- a/src/frontend/src/utils.ts +++ b/src/frontend/src/utils.ts @@ -1,5 +1,4 @@ import clsx, { ClassValue } from "clsx"; -import _ from "lodash"; import { ReactFlowInstance } from "reactflow"; import { twMerge } from "tailwind-merge"; import { ADJECTIVES, DESCRIPTIONS, NOUNS } from "./flow_constants"; @@ -14,27 +13,6 @@ export function cn(...inputs: ClassValue[]) { return twMerge(clsx(inputs)); } -export function toCamelCase(str: string) { - return str - .split(" ") - .map((word, index) => - index === 0 - ? word.toLowerCase() - : word[0].toUpperCase() + word.slice(1).toLowerCase() - ) - .join(""); -} -export function toFirstUpperCase(str: string) { - return str - .split(" ") - .map((word, index) => word[0].toUpperCase() + word.slice(1).toLowerCase()) - .join(""); -} - -export function snakeToSpaces(str: string) { - return str.split("_").join(" "); -} - export function toNormalCase(str: string) { let result = str .split("_") @@ -69,37 +47,6 @@ export function normalCaseToSnakeCase(str: string) { .join("_"); } -export function updateObject>( - reference: T, - objectToUpdate: T -): T { - let clonedObject = _.cloneDeep(objectToUpdate); - // Loop through each key in the object to update - for (const key in clonedObject) { - // If the key is not in the reference object, delete it - if (!(key in reference)) { - delete clonedObject[key]; - } - } - // Loop through each key in the reference object - for (const key in reference) { - // If the key is not in the object to update, add it - if (!(key in clonedObject)) { - clonedObject[key] = reference[key]; - } - } - return clonedObject; -} - -export function debounce(func, wait) { - let timeout; - return function (...args) { - const context = this; - clearTimeout(timeout); - timeout = setTimeout(() => func.apply(context, args), wait); - }; -} - interface languageMap { [key: string]: string | undefined; }