UNPKG

axiodb

Version:

The Pure JavaScript Alternative to SQLite. Embedded NoSQL database for Node.js with MongoDB-style queries, zero native dependencies, built-in InMemoryCache, and web GUI. Perfect for desktop apps, CLI tools, and embedded systems. No compilation, no platfor

28 lines 1.19 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); /* eslint-disable @typescript-eslint/no-explicit-any */ const worker_threads_1 = require("worker_threads"); const Searcher_utils_1 = __importDefault(require("../../utility/Searcher.utils")); const { chunk, query, isUpdated, aditionalFiled } = worker_threads_1.workerData; // Optimized for maximum performance const result = []; const chunkLength = chunk.length; // Simple linear loop is fastest for this use case // Modern JS engines optimize simple loops very well for (let i = 0; i < chunkLength; i++) { const rawItem = chunk[i]; const item = aditionalFiled ? rawItem[aditionalFiled] : rawItem; // Skip null/undefined checks with early continue if (item === undefined || item === null) continue; if (Searcher_utils_1.default.matchesQuery(item, query, isUpdated)) { result.push(rawItem); } } if (worker_threads_1.parentPort) { worker_threads_1.parentPort.postMessage(result); } //# sourceMappingURL=WorkerForSearch.engine.js.map