Skip to main content

Benji's personal standard library. Collection of tools for manipulating strings, async iterables, shell scripting, and common data structures.

This package works with Deno, BrowsersIt is unknown whether this package works with Cloudflare Workers, Node.js, Bun
It is unknown whether this package works with Cloudflare Workers
It is unknown whether this package works with Node.js
This package works with Deno
It is unknown whether this package works with Bun
This package works with Browsers
JSR Score
76%
Published
2 months ago (1.5.1)
N
async
No documentation available
f
async.each

Iterate over an async iterable, calling a callback for each value.

c
async.EventStream

Helper class to handle events and turn them into async iterables

f
async.once

Wait for any async iterable to yield a specific value according to a predicate.

f
async.pinkyPromise

A "destructured" Promise, useful for waiting for callbacks.

f
async.wait

Promise that resolves after timeout, optionally with a value to resolve with.

N
dom
No documentation available
f
dom.html

Parses HTML, kinda smart.

v
dom.HTML_ESCAPES

HTML escape sequences for unsafe characters

f
dom.textNode

Creates a text node for use in the DOM.

N
rng
No documentation available
c
rng.Mulberry32

A seeded RNG which implements Mulberry32

c
rng.Random

A simple RNG which returns numbers generated by Math.random()

c
rng.RNG

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)

N
shell
No documentation available
f
shell.koopa

Run a shell script.Factory facade to easily interact and run shell scripts

T
shell.ShellSpawner

Shell spawner.

I
shell.ShellSpawnerOpts
No documentation available
c
shell.Troopa
No documentation available
N
string
No documentation available
f
string.dedent

Removes indentation from multiline strings.

f
string.html

Escapes HTML on the server-side.

v
string.HTML_ESCAPES

HTML escape sequences for unsafe characters

f
string.templateNoop

A no-operation function for tagged template string literals

f
string.xss

Escapes unsafe strings for use in HTML

f
dom.domWalker

Walks the DOM recursively, calling the callback for each node.

f
each

Iterate over an async iterable, calling a callback for each value.

c
EventStream

Helper class to handle events and turn them into async iterables

f
once

Wait for any async iterable to yield a specific value according to a predicate.

f
pinkyPromise

A "destructured" Promise, useful for waiting for callbacks.

f
wait

Promise that resolves after timeout, optionally with a value to resolve with.

f
html

Parses HTML, kinda smart.

v
HTML_ESCAPES

HTML escape sequences for unsafe characters

f
textNode

Creates a text node for use in the DOM.

f
domWalker

Walks the DOM recursively, calling the callback for each node.

f
divide

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.

f
fill

Creates an iterable that always yields the given value.

f
limit

Given an iterable, yields the first count items, then returns.

f
limitAsync

Given an async iterable, yields the first count items, then returns.

T
Prettify
No documentation available
f
range

A ganerator that yields numbers between a range, akin to Python'srange.If start is greater than end, the range will decrement accordingly

f
removeFromArraybyIndexes

Removes elements from an array. Non-destructive, as all array operations should be :D

T
Repeated

Represents a homogenous array of a fixed length.

f
swap

Swaps two elements of an array. Note that this function swapsthe elements in place, meaning the original array is modified.

f
choose
No documentation available
f
shuffle
No documentation available
c
Mulberry32

A seeded RNG which implements Mulberry32

c
Random

A simple RNG which returns numbers generated by Math.random()

c
RNG

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)

f
koopa

Run a shell script.Factory facade to easily interact and run shell scripts

T
ShellSpawner

Shell spawner.

I
ShellSpawnerOpts
No documentation available
c
Troopa
No documentation available
f
dedent

Removes indentation from multiline strings.

f
html

Escapes HTML on the server-side.

v
HTML_ESCAPES

HTML escape sequences for unsafe characters

f
templateNoop

A no-operation function for tagged template string literals

f
xss

Escapes unsafe strings for use in HTML

c
Edge

Represents an edge in a graph which connects two vertices.

T
EdgeType
No documentation available
c
Graph

Represents a graph, consisting of vertices and edges.

c
Path
No documentation available
T
PathType
No documentation available
c
Vertex

Represents a vertex in a graph.

T
VertexType
No documentation available
T
WeightFn

Given an edge, this function should return the weight of that edge.

c
GraphSolver

A graph solver, which can perform various algorithms on a graph.

T
SearchFn

Describes a search function for DFS and BFS.

c
Matrix
No documentation available
f
isPrime

Verify if a given number is prime.

f
primes

Yields prime numbers in ascending order

N
DisjointSet
No documentation available
c
DisjointSet.DisjointSet
No documentation available
N
Heap
No documentation available
c
Heap.BinaryHeap

A minimum binary heap.

N
Memo
No documentation available
I
Memo.Cachelike

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.

c
Memo.Memo

Converts a function into a memo.

I
Memo.MemoOpts
No documentation available
N
Queue
No documentation available
c
Queue.Queue

Data structure allowing for the insertion and removal ofelements in a FIFO manner in O(1) time.

N
Stack
No documentation available
c
Stack.Stack

Data structure allowing for the insertion and removal ofelements in a LIFO manner in O(1) time.

N
StateMachine
No documentation available
c
StateMachine.StateMachine
No documentation available
T
StateMachine.Transition
No documentation available