2
0

Customizable allowed origins

This commit is contained in:
Baptiste Arnaud
2024-01-17 09:04:07 +01:00
parent b2f8cd44b8
commit 8771def9a1
12 changed files with 151 additions and 5 deletions

View File

@ -20,9 +20,11 @@ export const deepParseVariables =
},
parseVariablesOptions: ParseVariablesOptions = defaultParseVariablesOptions
) =>
<T extends Record<string, unknown>>(object: T): T =>
Object.keys(object).reduce<T>((newObj, key) => {
const currentValue = object[key]
<T>(object: T): T => {
if (!object) return object as T
if (typeof object !== 'object') return object as T
return Object.keys(object).reduce<T>((newObj, key) => {
const currentValue = (object as Record<string, unknown>)[key]
if (typeof currentValue === 'string') {
const parsedVariable = parseVariables(
@ -63,3 +65,4 @@ export const deepParseVariables =
return { ...newObj, [key]: currentValue }
}, {} as T)
}