Utilities
Orama exposes some of its internal utility functions:
Every exposed method comes with its own type definition. Each method is an async function. This is mandatory to support usage in CommonJS.
boundedLevenshtein
Computes the Levenshtein distance between two strings (a, b)
, returning early with -1 if the distance is greater than the given tolerance. It assumes that tolerance >= ||a| - |b|| >= 0
.
formatBytes
Takes a BigInt
as input and returns a human-readable string
.
formatNanoseconds
Takes a BigInt
as input and returns a human-readable string
.
getNanosecondsTime
Gets the current time with nanoseconds-precision. Returns a BigInt
.
uniqueId
Returns a uniqueId for a document as a string
.
TypeScript
If you cannot use set moduleResolution
to nodenext
or node16
in the tsconfig.json
, you can import internals directly from the main entrypoint: