Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Merge branch 'develop' into search-paste
Browse files Browse the repository at this point in the history
  • Loading branch information
peterscheu-aceart committed Jul 24, 2023
2 parents 67fcd51 + b6e373c commit 4eb2f43
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/utils/SnakedObject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ export function snakeToCamel(s: string): string {
}

export class SnakedObject<T = Record<string, any>> {
private fallbackWarnings = new Set<string>();

public constructor(private obj: T) {}

public get<K extends string & keyof T>(key: K, altCaseName?: string): T[K] {
Expand All @@ -27,7 +29,8 @@ export class SnakedObject<T = Record<string, any>> {

const fallbackKey = altCaseName ?? snakeToCamel(key);
const fallback = this.obj[<K>fallbackKey];
if (!!fallback) {
if (!!fallback && !this.fallbackWarnings.has(fallbackKey)) {
this.fallbackWarnings.add(fallbackKey);
console.warn(`Using deprecated camelCase config ${fallbackKey}`);
console.warn(
"See https://github.com/vector-im/element-web/blob/develop/docs/config.md#-deprecation-notice",
Expand Down

0 comments on commit 4eb2f43

Please sign in to comment.