HEX
Server: LiteSpeed
System: Linux houston.panomity.com 6.8.0-100-generic #100-Ubuntu SMP PREEMPT_DYNAMIC Tue Jan 13 16:40:06 UTC 2026 x86_64
User: nudepix (1011)
PHP: 7.4.33
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: //opt/LC/node_modules/mnemonist/default-weak-map.js
/**
 * Mnemonist DefaultWeakMap
 * =========================
 *
 * JavaScript implementation of a default weak map that will return a constructed
 * value any time one tries to access an non-existing key. It is similar to
 * DefaultMap but uses ES6 WeakMap that only holds weak reference to keys.
 */

/**
 * DefaultWeakMap.
 *
 * @constructor
 */
function DefaultWeakMap(factory) {
  if (typeof factory !== 'function')
    throw new Error('mnemonist/DefaultWeakMap.constructor: expecting a function.');

  this.items = new WeakMap();
  this.factory = factory;
}

/**
 * Method used to clear the structure.
 *
 * @return {undefined}
 */
DefaultWeakMap.prototype.clear = function() {

  // Properties
  this.items = new WeakMap();
};

/**
 * Method used to get the value set for given key. If the key does not exist,
 * the value will be created using the provided factory.
 *
 * @param  {any} key - Target key.
 * @return {any}
 */
DefaultWeakMap.prototype.get = function(key) {
  var value = this.items.get(key);

  if (typeof value === 'undefined') {
    value = this.factory(key);
    this.items.set(key, value);
  }

  return value;
};

/**
 * Method used to get the value set for given key. If the key does not exist,
 * a value won't be created.
 *
 * @param  {any} key - Target key.
 * @return {any}
 */
DefaultWeakMap.prototype.peek = function(key) {
  return this.items.get(key);
};

/**
 * Method used to set a value for given key.
 *
 * @param  {any} key   - Target key.
 * @param  {any} value - Value.
 * @return {DefaultMap}
 */
DefaultWeakMap.prototype.set = function(key, value) {
  this.items.set(key, value);
  return this;
};

/**
 * Method used to test the existence of a key in the map.
 *
 * @param  {any} key   - Target key.
 * @return {boolean}
 */
DefaultWeakMap.prototype.has = function(key) {
  return this.items.has(key);
};

/**
 * Method used to delete target key.
 *
 * @param  {any} key   - Target key.
 * @return {boolean}
 */
DefaultWeakMap.prototype.delete = function(key) {
  return this.items.delete(key);
};

/**
 * Convenience known methods.
 */
DefaultWeakMap.prototype.inspect = function() {
  return this.items;
};

if (typeof Symbol !== 'undefined')
  DefaultWeakMap.prototype[Symbol.for('nodejs.util.inspect.custom')] = DefaultWeakMap.prototype.inspect;

/**
 * Exporting.
 */
module.exports = DefaultWeakMap;