mirror of
https://github.com/discordeno/discordeno.git
synced 2026-09-17 08:47:22 +00:00
fix(util/utils): remove ID handling from case manipulation functions
This commit is contained in:
+5
-10
@@ -53,19 +53,14 @@ export const formatImageURL = (
|
||||
};
|
||||
|
||||
function camelToSnakeCase(text: string) {
|
||||
return text.replace(/Id|[A-Z]/g, ($1) => {
|
||||
if ($1 === "Id") return "_id";
|
||||
|
||||
return `_${$1.toLowerCase()}`;
|
||||
});
|
||||
return text.replace(/Id|[A-Z]/g, ($1) => `_${$1.toLowerCase()}`);
|
||||
}
|
||||
|
||||
function snakeToCamelCase(text: string) {
|
||||
return text.replace(/_id|([-_][a-z])/ig, ($1) => {
|
||||
if ($1 === "_id") return "Id";
|
||||
|
||||
return $1.toUpperCase().replace("_", "");
|
||||
});
|
||||
return text.replace(
|
||||
/_id|([-_][a-z])/ig,
|
||||
($1) => $1.toUpperCase().replace("_", ""),
|
||||
);
|
||||
}
|
||||
|
||||
function isObject(obj: unknown) {
|
||||
|
||||
Reference in New Issue
Block a user