export const TypographyType = {
[TypographyTypeStyle.h1]: 'h1',
[TypographyTypeStyle.h2]: 'h2',
[TypographyTypeStyle.h3]: 'h3',
[TypographyTypeStyle.h4]: 'h4',
[TypographyTypeStyle.p1]: 'p',
[TypographyTypeStyle.p2]: 'p',
} as const;
background: url("data:image/svg+xml, --- --- --- ") center no-repeat;
background: url("data:image/svg+xml, --- --- --- ") center no-repeat,
url("data:image/svg+xml, --- --- --- ") center no-repeat,
url("data:image/svg+xml, --- --- --- ") center no-repeat;
type AsCamelCase<S extends string> = S extends `${infer A}_${infer B}` ? `${A}${Capitalize<AsCamelCase<B>>}` : S;
type CamelCaseKeysRecord<T> = T extends Record<PropertyKey, unknown> ? {
[K in string & keyof T as AsCamelCase<K>]: CamelCaseKeysRecord<T[K]>;
} & {
[K in Exclude<keyof T, string>]: CamelCaseKeysRecord<T[K]>;
} : T;
function toCamelCaseKeys<T>(val: T): CamelCaseKeysRecord<T> {
if (Array.isArray(val)) {
return val.map(toCamelCaseKeys) as unknown as CamelCaseKeysRecord<T>;
}
if (typeof val === 'object') {
return Object.fromEntries(Object
.entries(val)
.map(([k, v]) => [
k.replace(/_+(.)/g, (_, g) => g.toUpperCase()),
toCamelCaseKeys(v as Record<string, unknown>),
])) as CamelCaseKeysRecord<T>;
}
return val as unknown as CamelCaseKeysRecord<T>;
}
const toCamelCase = val =>
val instanceof Array
? val.map(toCamelCase)
: val instanceof Object
? Object.fromEntries(Object
.entries(val)
.map(n => [
n[0].replace(/_+(.)/g, (m, g1) => g1.toUpperCase()),
toCamelCase(n[1]),
])
)
: val;