Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@homeofthings/node-utils

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@homeofthings/node-utils

HomeOfThings - Node Utils: various utilities and common types

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
18
increased by28.57%
Maintainers
1
Weekly downloads
 
Created
Source

npm version Build Workflow Coverage Status DeepScan grade Known Vulnerabilities

PRs Welcome License

@homeofthings/node-utils

  • AsyncContext<T>: little wrapper around AsyncLocalStorage providing default value

    asyncContext = new AsyncContext(defaultContext);
    ...
    asyncContext.set(newContext)
    ...
    currentContext = asyncContext.get();
    
    
  • sequentialize: run Promises in sequence

    await sequentialize(item.map(() => doWork(item)));
    
  • wait: wait until a condition is true or timed out

    await wait(condition); // polls until condition is true
    await wait(condition, 1000);  // polls until condition is true or timed out after 1000ms
    
  • LruCache<T>: LRU cache

    cache = new LruCache<UserSession, number>(SESSION_CACHE_SIZE);
    
    cache.set(id, userSession); // add this to the cache and mark it as least recently used
    ...
    cache.get(anotherId); // if it is available in the cache it will be marked as least recently used
    
  • WritableStrings: a Writable for writing to a string array

  • quoteArgs and quoteArg: quote arguments for better readability (e.g. for logging)

Keywords

FAQs

Package last updated on 18 Dec 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc