File tree Expand file tree Collapse file tree 3 files changed +40
-136
lines changed Expand file tree Collapse file tree 3 files changed +40
-136
lines changed Original file line number Diff line number Diff 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
489475Some predefined event handlers are available to use alone or as part of a more
490476complex 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.
Original file line number Diff line number Diff 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
147130api . logEventHandler = function logEventHandler ( { event, next} ) {
148131 console . log ( `EVENT: ${ event . message } ` , { event} ) ;
You can’t perform that action at this time.
0 commit comments