All files / src/utils getDevicePixelRatio.js

90% Statements 9/10
62.5% Branches 10/16
100% Functions 1/1
90% Lines 9/10

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  10x 10x 10x 10x   10x     10x 10x 10x   10x    
export function getDevicePixelRatio(roundDpr) {
  roundDpr = roundDpr == null ? true : roundDpr;
  let dpr = (typeof window !== "undefined" && window !== null ? window.devicePixelRatio : void 0) || 1;
  Eif (roundDpr) {
    dpr = Math.ceil(dpr);
  }
  Iif (dpr <= 0 || dpr === (0/0)) {
    dpr = 1;
  }
  let dprString = dpr.toString();
  Eif (dprString.match(/^\d+$/)) {
    dprString += '.0';
  }
  return dprString;
}