module import * as jsonld from 'jsonld' ; const nodeDocumentLoader = jsonld . documentLoaders . node ( ) ; type CachedDocuments = { [ index ] : any ; } ; function param { object } documents export const createDocumentLoader = ( documents = { } ) => { return async ( url ) => { const context = documents [ url ] ; if ( context !== undefined ) { return { contextUrl : null , documentUrl : url , document : context } ; } const result = await nodeDocumentLoader ( url ) ; documents [ url ] = result . document ; return result ; } ; } ;