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/elite/node_modules/debug-fabulous/src/lazy-eval.js
var objectAssign = require('object-assign');
var memoize = require('memoizee');

function _resolveOutput(func, bindThis) {
  var wrapped = function() {
    var i = arguments.length;
    var args = [];
    while (i--) args[i] = arguments[i];

    // lazy function eval to keep output memory pressure down, if not used
    if (typeof args[0] === 'function') {
      args[0] = args[0]();
    }
    return func.apply(bindThis, args);
  };
  objectAssign(wrapped, func);

  return wrapped;
}

function wrapEval(_debug) {
  var debugOrig = _debug;

  function debug(namespace) {
    function noop() {}
    var instance = debugOrig(namespace);
    /*
      If we're not enabled then don't attempt to log anything.
      Therefore when a  debug namespace wraps its debug in a
      closure then it never allocates anything but the function itself
    */
    if (!instance.enabled) {
      objectAssign(noop, instance);
      return noop;
    }
    return _resolveOutput(instance);
  }

  var debugMemoized = memoize(debug);

  objectAssign(debugMemoized, debugOrig);

  return debugMemoized;
}

module.exports = wrapEval;