Files
2026-01-22 15:49:12 +01:00

24 lines
538 B
TypeScript
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* Mnemonist BKTree Typings
* =========================
*/
type DistanceFunction<T> = (a: T, b: T) => number;
export default class BKTree<T> {
// Members
distance: DistanceFunction<T>;
size: number;
// Constructor
constructor(distance: DistanceFunction<T>);
// Methods
add(item: T): this;
search(n: number, query: T): Array<{item: T, distance: number}>;
toJSON(): object;
inspect(): any;
// Statics
static from<I>(iterable: Iterable<I> | {[key: string]: I}, distance: DistanceFunction<I>): BKTree<I>;
}