ginnungagap
... is the formless void before all else
These are stand-alone TypeScript utilities, not depending on any frameworks. (In other words, this is the "utils" kitchensink).
Undefined Handling
is heavily inspired by Guava's Preconditions, and null-handling in Strings, but also contains TypeScript-specific narrowing guards.
Comparison
has null-aware comparison, and can be used to build a comparator which compares multiple fields in objects.
It also sorts embedded numbers (integers) according to their numeric value; not their lexical order, so, say,
A2: Something
sorts before A10: Other
.
TrigramIndex
is a fuzzy search algorithm for in-memory arrays of objects. This is very effective for something like filtering lists
on a couple of keystrokes, quickly narrowing down a selection.
If you need more full-featured text search, consider something like https://lunrjs.com/.
Arrays
contains a shuffle function to randomize an array (correctly).
Usage
Install with
npm install @northtech/ginnungagap@^1.3
TypeDocs at https://doc.northtech.dk/ginnungagap/