docusaurus-plugin-typedoc-api
Version:
Docusaurus plugin that provides source code API documentation powered by TypeDoc.
24 lines (21 loc) • 712 B
JavaScript
;
const react = require('react');
const ApiDataContext = require('../components/ApiDataContext.js');
function useReflection(id, required) {
const _react$useContext = react.useContext(ApiDataContext.ApiDataContext),
reflections = _react$useContext.reflections;
// 0 is a valid ID
if (id === undefined && !required) {
return null;
}
if (id !== undefined && reflections[id]) {
return reflections[id];
}
throw new Error(`Unable to find declaration with ID ${id}`);
}
function useRequiredReflection(id) {
return useReflection(id, true);
}
exports.useReflection = useReflection;
exports.useRequiredReflection = useRequiredReflection;
//# sourceMappingURL=useReflection.js.map