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

thingies

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

thingies

Useful TypeScript utilities.

  • 1.3.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2M
decreased by-16.91%
Maintainers
1
Weekly downloads
 
Created
Source

thingies

Useful TypeScript utilities.

Menu

  • base64 — Base64 encoding end decoding functions for Node.js.

  • Cache — implementation of local memory cache for database records. Can cache retrieved database records for few dozen seconds and has garbage collection logic which clears the memory of old items after some time.

  • Defer — an inverted Promise, an object which allows you to imperatively control the behavior of a Promise.

  • hash — a fast and simple utility, which hashes a string to an integer. Useful for generating a shard index of a record based on its ID.

  • LruMap — tiny and fast Least Recently Used Cache implemented on top of the Map class.

  • LruTtlMap — tiny and fast Least Recently Used Cache with expiration timestamp stored for each entry implemented on top of the LruMap class.

  • normalizeEmail — normalizes email by stripping out . and + characters and removing everything after the + character and lower-casing the e-mail. Useful for getting an e-mail into a common form when throttling requests by e-mail.

  • of — returns result of a Promise as a 3-tuple [value, error, isError].

  • promiseMap — maps a list of values to an async function and waits until all results complete execution.

  • randomStr — generates a random string of given size. Alphabet for character picking can be provided. Useful for generating random database record IDs.

  • TimedQueue — a queue which can be flushed manually, or which flushes automatically when the number of queued items reaches a threshold or when a timeout expires since the first item was added to the queue. Useful for batching multiple messages or requests for bulk processing.

  • TimedState — works similar to TimedQueue, but instead of keeping track of all items pushed, it invokes a reducer to update the state with the information from the last pushed item.

  • tick — returns a Promise which resolves after a given number of milliseconds, useful for releasing the event loop for a short period of time, await tick(5).

  • until — waits for some condition to become true await until(() => condition), useful when waiting for some asynchronous task to happen in a test.

License

MIT © Vadim Dalecky.

FAQs

Package last updated on 02 Jul 2022

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