NH_base

Base library usable any time.

As of 2023-10-28. See the latest version.

This script should not be not be installed directly. It is a library for other scripts to include with the meta directive // @require https://update.greasyfork.org/scripts/477290/1271886/NH_base.js

Author
Mike Castle (Nexus)
Version
19
Created
2023-10-12
Updated
2023-10-28
Size
41.1 KB
License
GPL-3.0-or-later

lib/base - A NexusHoratio library.

Pure JavaScript stuff. Nothing here should be WEB API aware, except Logger's use of console.

Exported properties (as of version 15)

  • version - Bumped per release.
  • NOT_FOUND - Constant (to make eslint's no-magic-numbers setting happy).
  • testing - Object for testing support (to be replaced with TestCase).
  • ensure - Ensures appropriate versions of NexusHoratio libraries are loaded.
  • DefaultMap - Subclass of Map similar to Python's defaultdict.
  • Logger - Fancy-ish log messages (likely over engineered).
  • uuId - Create a UUID-like string with a base.
  • safeId - Normalizes a string to be safe to use as an HTML element id.
  • strHash - Equivalent (for now) of Java's hashCode (do not store externally).
  • Dispatcher - Simple dispatcher (event bus).

More details are in base.js as JSDoc.