UNPKG

@hyperjump/browser

Version:

Browse JSON-compatible data with hypermedia references

16 lines (12 loc) 363 B
import { parse } from "../jref/index.js"; export const jrefMediaTypePlugin = { parse: async (response) => { return { baseUri: response.url, root: parse(await response.text()), anchorLocation: anchorLocation }; }, fileMatcher: (path) => /[^/]\.jref$/.test(path) }; const anchorLocation = (fragment) => decodeURI(fragment || "");