Skip to content

HelpfulScripts/hsUtil

Repository files navigation

hsUtil

NPM License npm version docs Build Status codecov Known Vulnerabilities Dependencies Status

Helpful Scripts utility functions for use in both browser and node environments

Installation

npm i hsutil

Provided Functions - no external dependencies:

  • Pacing functions that
    • paces a series of function calls to not occur faster than a preset rate not issue more unresolved calls then a preset limit.
    • provide delays and timeouts for promises.
  • CheckSum a quick checksum implementation for small strings
  • Date printf-style date formatting function
  • uniquefy removes duplicates from arrays, as defined by a selectable key
  • log console.log - style logging utility supporting
    • module-level logging and configuration of module IDs and time stamp format
      log.inform('passed'); // -> 20200516 11:21:54 myModule INFO passed
    • global and module-level filtering of the severity of log outputs: debug, inform, warn, error
    • optional functional call type to avoid compiling messages that will be filtered
      log,inform(()=>passed);
    • colored log messages, by severity
    • colored inspect output, by indentation level
    • configurable message-middle truncating to limit maximum message length

See docs for details