npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

thingies

v2.5.0

Published

Useful TypeScript utilities.

Downloads

10,640,025

Readme

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.

  • @debug — a class method or function decorator, which logs the input and output of the function in non-production environments.

  • 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. The default limit is around 1 billion items (2^30 - 1).

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

  • LruCache — a Least Recently Used Cache implemented using Object and doubly linked list. The default limit is around 1 billion items (2^30 - 1).

  • 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.

  • concurrency — limits the number of concurrent executions of asynchronous code. concurrencyDecorator limits the number of concurrent executions of a class method.

  • codeMutex — a mutex which can be used to synchronize code execution. Code wrapped by this mutex will execute only one at a time, for all parallel calls to the same mutex.

  • @mutex and mutex() — same as codeMutex, but can be used as a decorator or a higher order function.


  • once — a class method decorator, which limits method execution to once per instance. Returns the result of the first execution for all subsequent calls.

  • loadCss — loads a CSS file into the DOM, given a URL. Does nothing on the server.

  • dataUri — converts a string to a data URI.

  • FanOut — a class which allows to fan out a single event to multiple listeners. Useful for implementing event emitters. In just 12 lines of code.

  • createRace — constructs a "race" function, which takes a function as a single argument, the function is executed immediately only if no other function is currently executing. If another function is currently executing, the current function is discarded.

  • xorShift32 — generates random 32-bit integers using the very fast xorshift algorithm. makeXorShift32(seed) returns a function which can be used to generate random numbers.

  • Locks — a lock manager, which allows to acquire an exclusive lock in browser across multiple tabs. Acquires a lock by writing to localStorage for a specific key for a specified duration.

  • hasKeys — returns true if an object has at lest on key.

  • timeout — waits for async code to complete within a given time frame, otherwise throws an error.

License

MIT © Vadim Dalecky.