RunnableFunction.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.ParsingToolFunction = exports.ParsingFunction = exports.isRunnableFunctionWithParse = void 0;
  4. function isRunnableFunctionWithParse(fn) {
  5. return typeof fn.parse === 'function';
  6. }
  7. exports.isRunnableFunctionWithParse = isRunnableFunctionWithParse;
  8. /**
  9. * This is helper class for passing a `function` and `parse` where the `function`
  10. * argument type matches the `parse` return type.
  11. *
  12. * @deprecated - please use ParsingToolFunction instead.
  13. */
  14. class ParsingFunction {
  15. constructor(input) {
  16. this.function = input.function;
  17. this.parse = input.parse;
  18. this.parameters = input.parameters;
  19. this.description = input.description;
  20. this.name = input.name;
  21. }
  22. }
  23. exports.ParsingFunction = ParsingFunction;
  24. /**
  25. * This is helper class for passing a `function` and `parse` where the `function`
  26. * argument type matches the `parse` return type.
  27. */
  28. class ParsingToolFunction {
  29. constructor(input) {
  30. this.type = 'function';
  31. this.function = input;
  32. }
  33. }
  34. exports.ParsingToolFunction = ParsingToolFunction;
  35. //# sourceMappingURL=RunnableFunction.js.map