bun-util
Source: lib/bun/util.js
The Bun.* utility functions, loaded on the first read of one of them from the bun global. Names, argument shapes and results follow Bun (checked against bun 1.4.2).
Bun.* | Implemented with |
|---|---|
deepEquals(a, b, strict) | own walk, SameValue for primitives |
deepMatch(subset, value) | own walk, arrays must have the same length |
inspect(v, opts) | native inspect, inspect.custom is Node's symbol |
nanoseconds() | performance.now() in nanoseconds |
sleep(ms or Date), sleepSync(ms) | setTimeout, os.sleep |
peek(p), peek.status(p) | misc.promiseState, promiseResult |
which(cmd, { PATH, cwd }) | a PATH walk, executable regular files only |
readableStreamTo* | one reader loop |
stripANSI, stringWidth | terminal |
fileURLToPath, pathToFileURL, Glob | re-exported from url and glob |
Export list
Generated by utilities/doc-api.js from the bun_util dump of utilities/api-surface.sh: 28 members. Edit the text above this block, not the block.
Functions: allocUnsafe(), concatArrayBuffers(), deepEquals(), deepMatch(), escapeHTML(), fileURLToPath(), gc(), indexOfLine(), inspect(), nanoseconds(), pathToFileURL(), peek(), readableStreamToArray(), readableStreamToArrayBuffer(), readableStreamToBlob(), readableStreamToBytes(), readableStreamToJSON(), readableStreamToText(), sleep(), sleepSync(), stringWidth(), stripANSI(), which()
Glob
class, constructible
- methods:
match(),scan(),scanSync()