UNPKG

@rws-air/utils

Version:
20 lines 771 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.FuzzySearcher = void 0; const fuse_js_1 = __importDefault(require("fuse.js")); class FuzzySearcher { constructor(obj, keys, options) { this.object = obj; this.fuseOptions = Object.assign(Object.assign({ threshold: 0.2 }, options), { keys }); } runFuzzy(query) { const locquery = query.toLowerCase(); const fuzzyFuze = new fuse_js_1.default(this.object, this.fuseOptions); return fuzzyFuze.search(locquery); } } exports.FuzzySearcher = FuzzySearcher; //# sourceMappingURL=FuzzySearcher.js.map