FlashFuzzy API

FlashFuzzy exposes a single class, FlashFuzzy, that wraps the WebAssembly module. All search logic runs in the WASM sandbox; the JS surface is intentionally thin.

npm install flashfuzzy

FlashFuzzy.create()

static FlashFuzzy.create(): Promise<FlashFuzzy>
Returns: Promise<FlashFuzzy>

Initialises the WebAssembly module and returns a ready FlashFuzzy instance. Must be awaited before any other call. Safe to call once per page load.

import { FlashFuzzy } from "flashfuzzy";

const ff = await FlashFuzzy.create();
console.log("FlashFuzzy ready");

ff.index()

ff.index(records: T[]): void
Returns: void

Tokenises each record and builds the Bloom filter index. Accepts arrays of strings, objects, or JSON. Fields are concatenated for multi-field search.

ff.index([
  { id: 1, name: "React Hooks", tags: ["react", "js"] },
  { id: 2, name: "Vue Composition API", tags: ["vue", "js"] },
]);

ff.clear()

ff.clear(): void
Returns: void

Clears all indexed records and resets the BSS store. The instance is immediately ready to index a new dataset.

ff.clear();
console.log("Index cleared, ready for new records");