Skip to content

Commit 91a25c6

Browse files
committed
Remove "strict" mode support.
- Unused as everything moved into "safe" mode.
1 parent c77ca7c commit 91a25c6

File tree

3 files changed

+40
-136
lines changed

3 files changed

+40
-136
lines changed

README.md

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -470,29 +470,12 @@ const expanded = await jsonld.expand(data, {
470470
});
471471
```
472472

473-
#### Strict Validation
474-
475-
Some data may be valid and "safe" but still have issues that could indicate
476-
data problems. A "strict" validation mode is available that handles more issues
477-
that the "safe" validation mode. This mode may cause false positives so may be
478-
best suited for JSON-LD authoring tools.
479-
480-
```js
481-
// expand a document in strict mode
482-
const expanded = await jsonld.expand(data, {
483-
eventHandler: jsonld.strictEventHandler
484-
});
485-
```
486-
487473
#### Available Handlers
488474

489475
Some predefined event handlers are available to use alone or as part of a more
490476
complex handler:
491477

492478
- **safeEventHandler**: The handler used when `safe` is `true`.
493-
- **strictEventHandler**: A handler that is more strict than the `safe`
494-
handler and also fails on other detectable events related to possible input
495-
issues.
496479
- **logEventHandler**: A debugging handler that outputs to the console.
497480
- **logWarningHandler**: A debugging handler that outputs `warning` level
498481
events to the console.

lib/events.js

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -126,23 +126,6 @@ api.safeEventHandler = function safeEventHandler({event, next}) {
126126
next();
127127
};
128128

129-
const _notStrictEventCodes = new Set([
130-
..._notSafeEventCodes,
131-
]);
132-
133-
// strict handler that rejects all warning conditions
134-
api.strictEventHandler = function strictEventHandler({event, next}) {
135-
// fail on all warnings
136-
if(event.level === 'warning' && _notStrictEventCodes.has(event.code)) {
137-
throw new JsonLdError(
138-
'Strict mode validation error.',
139-
'jsonld.ValidationError',
140-
{event}
141-
);
142-
}
143-
next();
144-
};
145-
146129
// logs all events and continues
147130
api.logEventHandler = function logEventHandler({event, next}) {
148131
console.log(`EVENT: ${event.message}`, {event});

0 commit comments

Comments
 (0)