openredaction 1.0.7 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,11 +10,13 @@ npm install openredaction
|
|
|
10
10
|
|
|
11
11
|
## Quick Start
|
|
12
12
|
|
|
13
|
+
`detect()` is **async** — use `await` (inside an `async` function or with top-level `await` in ESM).
|
|
14
|
+
|
|
13
15
|
```typescript
|
|
14
16
|
import { OpenRedaction } from 'openredaction';
|
|
15
17
|
|
|
16
18
|
const shield = new OpenRedaction();
|
|
17
|
-
const result = shield.detect("Email john@example.com or call 07700900123");
|
|
19
|
+
const result = await shield.detect("Email john@example.com or call 07700900123");
|
|
18
20
|
|
|
19
21
|
console.log(result.redacted);
|
|
20
22
|
// "Email [EMAIL_9619] or call [PHONE_UK_MOBILE_9478]"
|
|
@@ -51,7 +53,6 @@ const detector = new OpenRedaction({
|
|
|
51
53
|
}
|
|
52
54
|
});
|
|
53
55
|
|
|
54
|
-
// detect() is now async when AI is enabled
|
|
55
56
|
const result = await detector.detect('Contact John Doe at john@example.com');
|
|
56
57
|
```
|
|
57
58
|
|
|
@@ -74,7 +75,7 @@ export OPENREDACTION_AI_ENDPOINT=https://your-api.example.com
|
|
|
74
75
|
|
|
75
76
|
- **AI is optional**: The library works exactly as before when `ai.enabled` is `false` or omitted
|
|
76
77
|
- **Regex is primary**: AI only adds additional entities; regex detections always take precedence
|
|
77
|
-
- **No breaking changes**: When AI is disabled,
|
|
78
|
+
- **No breaking changes**: When AI is disabled, detection is still regex-only; `detect()` always returns a `Promise`
|
|
78
79
|
- **Browser support**: In browsers, you must provide an explicit `ai.endpoint` (env vars not available)
|
|
79
80
|
- **Network dependency**: AI mode requires network access to the endpoint
|
|
80
81
|
|
|
@@ -92,7 +93,8 @@ const detector = new OpenRedaction({
|
|
|
92
93
|
|
|
93
94
|
## Documentation
|
|
94
95
|
|
|
95
|
-
|
|
96
|
+
- Site & playground: [openredaction.com](https://openredaction.com)
|
|
97
|
+
- Source & issues: [GitHub](https://github.com/sam247/openredaction)
|
|
96
98
|
|
|
97
99
|
## Features
|
|
98
100
|
|