HEX
Server: nginx/1.18.0
System: Linux test-ipsremont 5.4.0-214-generic #234-Ubuntu SMP Fri Mar 14 23:50:27 UTC 2025 x86_64
User: ips (1000)
PHP: 8.0.30
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/innodrive/src/js/modules-legacy/utils.js

export const isMobile = () => document.documentElement.clientWidth <= 991;
export const isTablet = () => document.documentElement.clientWidth <= 992;
export const isDesktop = () => document.documentElement.clientWidth > 1024;

export const plural = (number, one, two, five) => {
  let n = Math.abs(number);
  n %= 100;
  if (n >= 5 && n <= 20) {
    return five;
  }
  n %= 10;
  if (n === 1) {
    return one;
  }
  if (n >= 2 && n <= 4) {
    return two;
  }
  return five;
};

export const numberFormat = (number, decimals, decPoint, thousandsSep) => {
  let i;
  let j;
  let kw;
  let kd;
  let km;

  // input sanitation & defaults
  if (isNaN(decimals = Math.abs(decimals))) {
    decimals = 2;
  }
  if (decPoint === undefined) {
    decPoint = ',';
  }
  if (thousandsSep === undefined) {
    thousandsSep = '.';
  }

  i = parseInt(number = (+number || 0).toFixed(decimals)) + '';

  if ((j = i.length) > 3) {
    j = j % 3;
  } else {
    j = 0;
  }

  km = (j ? i.substr(0, j) + thousandsSep : '');
  kw = i.substr(j).replace(/(\d{3})(?=\d)/g, '$1' + thousandsSep);
  kd = (decimals ? decPoint + Math.abs(number - i).toFixed(decimals).replace(/-/, 0).slice(2) : '');

  return km + kw + kd;
};