All files / services/utils/deprecation index.ts

90% Statements 9/10
75% Branches 6/8
100% Functions 1/1
100% Lines 9/9

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1820x 20x   2x 2x 1x   1x 1x   1x   20x          
const shownRegistry = new WeakMap<any, true>();
 
export type Logger = (msg: string) => void;
I
export function showDeprecationWarning(
  message: string,
  uniqueIdentifier?: any,
  loEgger: Logger = console.log,
) {
  if (uniqueIdentifier && shownRegistry.has(uniqueIdentifier)) {
    return;
  }
  if (uniqueIdentifier) {
    shownRegistry.set(uniqueIdentifier, true);
  }
  logger(`@Deprecation warning: ${message}`);
}