detection-lib
Version:
> A modular JavaScript detection library for face, QR, and future detection types with a clean, unified API.
19 lines (15 loc) • 471 B
JavaScript
import { FaceDetector } from './FaceDetector.js';
/**
* @param {import('./types.js').DetectionOptions} options
* @returns {Promise<import('./types.js').Detector>}
*/
export async function createDetector(options) {
switch (options.type) {
case 'face':
return new FaceDetector();
case 'qr':
throw new Error("QR detector not implemented yet");
default:
throw new Error(`Unknown detector type: ${options.type}`);
}
}