packages/transform/src/get-context.js
async function getContext(target, contextOptions) {
	if (isURL(target)) {
		const cdef = await got(target)
			.then(response => {
				const contentType = response.headers["content-type"]
				switch (contentType) {
					case 'application/x-yaml':
					case 'application/x-yml':
						return yaml.load(response.body)
					case 'application/json':
					case 'application/ld+json':
						return JSON.parse(response.body)
					default:
						throw new Error(`context type not recognized ${contentType}`)
				}
			})
		return new Context(cdef, contextOptions)
	} else {
		return loadContext(target, contextOptions)
	}
}
async function getContext(target, contextOptions) {
	if (isURL(target)) {
		const cdef = await got(target)
			.then(response => {
				const contentType = response.headers["content-type"]
				switch (contentType) {
					case 'application/x-yaml':
					case 'application/x-yml':
						return yaml.load(response.body)
					case 'application/json':
					case 'application/ld+json':
						return JSON.parse(response.body)
					default:
						throw new Error(`context type not recognized ${contentType}`)
				}
			})
		return new Context(cdef, contextOptions)
	} else {
		return loadContext(target, contextOptions)
	}
}
async function getContext ( target , contextOptions ) { if ( isURL ( target ) ) { const cdef = await got ( target ) . then ( response => { const contentType = response . headers [ "content-type" ] switch ( contentType ) { case 'application/x-yaml' : case 'application/x-yml' : return yaml . load ( response . body ) case 'application/json' : case 'application/ld+json' : return JSON . parse ( response . body ) default : throw new Error ( ` ${ contentType } ` ) } } ) return new Context ( cdef , contextOptions ) } else { return loadContext ( target , contextOptions ) } }
fetch and parse context from a file or http url

@param {string} target
@param {object} [contextOptions]
@returns {Promise}
fetch and parse context from a file or http url