@stencila/jesta
Version:
Stencila plugin for executable documents using JavaScript
26 lines (25 loc) • 938 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.funcType = exports.funcs = void 0;
const session_1 = require("./util/session");
// A list of global variable names e.g. setTimeout which should not
// be included in the list of functions
const globals = Object.keys(globalThis);
/**
* List functions of the current document.
*
* Returns a map of the name and type signature of the current document's functions.
* See `vars` for an analogous method returning variables and their types.
*/
// eslint-disable-next-line @typescript-eslint/require-await
async function funcs() {
return Object.entries(session_1.session().context).reduce((prev, [name, value]) => !globals.includes(name) && typeof value === 'function'
? { ...prev, [name]: funcType(value) }
: prev, {});
}
exports.funcs = funcs;
function funcType(_func) {
// TODO
return 'TODO';
}
exports.funcType = funcType;