-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
Rather than
jsonld-context-parser.js/lib/ContextParser.ts
Lines 615 to 627 in 107a686
if (this.validateContext) { | |
try { | |
const parentContext = {...context, [key]: {...context[key]}}; | |
delete parentContext[key]['@context']; | |
await this.parse(value['@context'], | |
{ ...options, external: false, parentContext, ignoreProtection: true, ignoreRemoteScopedContexts: true, ignoreScopedContexts: true }); | |
} catch (e) { | |
throw new ErrorCoded(e.message, ERROR_CODES.INVALID_SCOPED_CONTEXT); | |
} | |
} | |
context[key] = {...value, '@context': (await this.parse(value['@context'], | |
{ ...options, external: false, minimalProcessing: true, ignoreRemoteScopedContexts: true, parentContext: context })) | |
.getContextRaw()} |
context[key] = {...value, '@context': (await this.parse(value['@context'],
{ ...options, external: false, ignoreRemoteScopedContexts: true, parentContext: context }))
.getContextRaw()}
This is because this takes the same time as the try/catch
call and prevents the parser from needing to re-expand the context during parsing thus reducing repeated operations.
This will also remove the need for caching objects in the context caching work.
Metadata
Metadata
Assignees
Labels
No labels