Benji's personal standard library. Collection of tools for manipulating strings, async iterables, shell scripting, and common data structures.
Iterate over an async iterable, calling a callback for each value.
Helper class to handle events and turn them into async iterables
Wait for any async iterable to yield a specific value according to a predicate.
A "destructured" Promise, useful for waiting for callbacks.
Promise that resolves after timeout, optionally with a value to resolve with.
Parses HTML, kinda smart.
HTML escape sequences for unsafe characters
Creates a text node for use in the DOM.
A seeded RNG which implements Mulberry32
A simple RNG which returns numbers generated by Math.random()
The base class for creating a (potentially seeded) random number generator.Provides a plethora of methods for manipulating objects with randomness.(I predicted you might need them, you are not random)
Run a shell script.Factory facade to easily interact and run shell scripts
Shell spawner.
Removes indentation from multiline strings.
Escapes HTML on the server-side.
HTML escape sequences for unsafe characters
A no-operation function for tagged template string literals
Escapes unsafe strings for use in HTML
Walks the DOM recursively, calling the callback for each node.
Iterate over an async iterable, calling a callback for each value.
Helper class to handle events and turn them into async iterables
Wait for any async iterable to yield a specific value according to a predicate.
A "destructured" Promise, useful for waiting for callbacks.
Promise that resolves after timeout, optionally with a value to resolve with.
Divides an array into two by a given predicate function.Those that pass are put into the first, the rest are put in the second.
Creates an iterable that always yields the given value.
Given an iterable, yields the first count
items, then returns.
Given an async iterable, yields the first count
items, then returns.
Removes elements from an array. Non-destructive, as all array operations should be :D
Represents a homogenous array of a fixed length.
Swaps two elements of an array. Note that this function swapsthe elements in place, meaning the original array is modified.
A seeded RNG which implements Mulberry32
A simple RNG which returns numbers generated by Math.random()
The base class for creating a (potentially seeded) random number generator.Provides a plethora of methods for manipulating objects with randomness.(I predicted you might need them, you are not random)
Run a shell script.Factory facade to easily interact and run shell scripts
Shell spawner.
Removes indentation from multiline strings.
Escapes HTML on the server-side.
HTML escape sequences for unsafe characters
A no-operation function for tagged template string literals
Escapes unsafe strings for use in HTML
Represents an edge in a graph which connects two vertices.
Represents a graph, consisting of vertices and edges.
Represents a vertex in a graph.
Given an edge, this function should return the weight of that edge.
A graph solver, which can perform various algorithms on a graph.
Describes a search function for DFS and BFS.
A minimum binary heap.
A cache-like object that can be used with Memo. This interface iscompatible with Map
, but it can also be used to implement other cachingstrategies, such as an LRU cache.
Converts a function into a memo.
Data structure allowing for the insertion and removal ofelements in a FIFO manner in O(1)
time.
Data structure allowing for the insertion and removal ofelements in a LIFO manner in O(1)
time.