UNPKG

@jplorg/jpl

Version:
24 lines (23 loc) 1.02 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _library = require("../library"); var _system = _interopRequireDefault(require("./system")); function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; } /** * Create an orphan JPL function from the specified source program string. * * Some optional scope presets may be specified, e.g. for allowing the function access to some specified variables. * Other than that, the function does not have access to any external variables. * * @param {string[]} argNames Names to bind the function arguments to * @param {string} source Source program string to execute * @param {{ vars: object? }} [presets] Optional scope presets */ async function parseFunction(argNames, source, presets) { const instructions = await _system.default.parseInstructions(source); return (0, _library.orphanFunction)(argNames, instructions, presets); } var _default = exports.default = parseFunction;