module import * as jsonld from 'jsonld' ; function param { object } document param { context } context param options param { string } options . base param { boolean } options . compactArrays param { boolean } options . compactToRelative param { boolean } options . graph param { context } options . expandContext param { boolean } options . skipExpansion param { documentLoader } options . documentLoader param { expansionMap } options . expansionMap param { boolean } options . framing param { compactionMap } options . compactionMap returns { Promise < object > } export const compact = async ( document , context , options = { } ) : Promise < object > => { return jsonld . compact ( document , context , options ) ; } ; function param { object } document param options param { string } options . base param { object } options . expandContext param { boolean } options . keepFreeFloatingNodes param { documentLoader } options . documentLoader param { expansionMap } options . expansionMap returns { Promise < object > } export const expand = async ( doc , options = { } ) : Promise < any > => { return jsonld . expand ( doc , options ) ; } ; function param { object } input param options param { string } options . algorithm param { string } options . base param { context } options . expandContext param { boolean } options . skipExpansion param { string } options . inputFormat param { string } options . format param { documentLoader } options . documentLoader param { boolean } options . useNative return { Promise < string > } export const canonize = async ( doc , options = { } ) : Promise < string > => { return jsonld . canonize ( doc , options ) ; } ; function param { object } input param { context } context param options param { string } options . base param { context } options . expandContext param { documentLoader } options . documentLoader return { Promise < object > } export const flatten = async ( input , context , options = { } ) : Promise < object > => { return jsonld . flatten ( input , context , options ) ; } ; function param { object } input param { object } frame param options param { string } options . base param { context } options . expandContext param { string } options . embed embed param { boolean } options . explicit explicit param { boolean } options . requireAll requireAll param { boolean } options . omitDefault omitDefault param { documentLoader } options . documentLoader return { Promise < object > } export const frame = async ( input , frame , options = { } ) : Promise < object > => { return jsonld . frame ( input , frame , options ) ; } ; function param { object } document param { string } id return { Promise < object | null > } export const findNodeById = async ( document , id ) : Promise < object | null > => { const flattened = await flatten ( document , { } ) ; if ( ! flattened . hasOwnProperty ( '@graph' ) ) { throw new Error ( '@graph property does not exist in the flattened document' ) ; } const graph = flattened [ '@graph' ] as Array < { [ index ] : any ; } > ; const node = graph . find ( element => { return element [ '@id' ] === id ; } ) ; if ( node === undefined ) { return null ; } return node ; } ;