Packages
I build a few open-source packages that you might find helpful. You can also follow me on GitHub.
NPM
-
thorish: a dumping ground for libraries.
I've attempted to consolidate the libraries that I use for a lot of my projects. This basically consists of helpers to do with
Map
/Set
, as well as lots of things to do with async iterators andPromise
. You can add this to yourdevDependencies
and then compile in the things you use, since it's tree-shakable and has no side-effects. -
but-csv: a 479 byte CSV parser and builder.
This was built in reaction to how complex even "light-weight" CSV libraries are: they do too much, and yes, they might be great for ~100mb CSVs, but not if you just want to bring everything into memory and get some data out quickly.
-
but-unzip: a small unzip library.
Work with zip files in your browser or Node. This is miniscule in Node, and small in the browser (~1kb) but unless you're only targeting Chrome (don't) you'll also need to include a ~20kb deflate helper (
pako
, which reimplements gzip). -
sents and sents-cli: a small filesystem watcher for build scripts
There's obviously tools like Chokidar which are the standard, but they have lots of dependencies and often include native code, the bane of every Node developer's existence. These two libraries do all of what those do, and deal with platform differences, all in JS.
-
fileparts: lets you modify paths in Node via helper object like
URL
This lets you modify and tweak paths (including dirname, ext and so on) like a mutable object.
-
viz-observer: notifies you when an element changes on your page
This is a library which provides something not built-in to the DOM: watches an element move or resize on your page, or basically change dimensions in any way. You have
ResizeObserver
, but there's noMoveObserver
—this provides a kind of union of that. It's really useful for say, showing a tooltip attached to another element, where you don't share the DOM tree. -
fast-text-encoding: a polyfill for
TextEncoder
andTextDecoder
You probably don't need this, browsers and Node have moved on. But it's heavily depended on.
-
undoer: allows you to arbirtrarily handle real browser undo/redo events
This is a useful library but is mostly a showcase of this blog post.