🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

detection-lib

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

detection-lib - npm Package Compare versions

Comparing version

to
1.0.1

2

package.json
{
"name": "detection-lib",
"version": "1.0.0",
"version": "1.0.1",
"main": "src/DetectorFactory.js",

@@ -5,0 +5,0 @@ "scripts": {

@@ -45,2 +45,29 @@

}
```
## API
#### createDetector(options)
- **options.type: 'face' | 'qr' | string** — The type of detector to create.
- Returns a detector instance with an async detect(input) method
### Detector Interface
All detectors implement:
```
async detect(input: HTMLVideoElement | HTMLImageElement | HTMLCanvasElement): Promise<DetectionResult>
```
### DetectionResult
- **type**: string — The detector type ('face', 'qr', etc.)
- **boxes**: Array of { x, y, w, h, score? } (for face, etc.)
- **data**: Any extra data (for QR, etc.)
### Extending
To add a new detector:
```
1. Create a new file in src/detectors/ (e.g., myDetector.js).
2. Implement a class with a detect() method.
3. Register it in the factory in src/DetectorFactory.js.
```