aboutsummaryrefslogtreecommitdiffstats
path: root/tools/may_execute_js_code.js
diff options
context:
space:
mode:
authorsigoden <sigoden@gmail.com>2024-06-07 15:16:31 +0800
committerGitHub <noreply@github.com>2024-06-07 15:16:31 +0800
commit739a832d87c00e3b5977a24bba5654fa5ea7a702 (patch)
tree2bb4c102a3e04b9c8c1ecd61bdb6c92f84ca27cb /tools/may_execute_js_code.js
parent2b07fc2c7e4e6311d35ae72c17b25e47680d61f6 (diff)
downloadllm-functions-docker-739a832d87c00e3b5977a24bba5654fa5ea7a702.tar.gz
feat: js/py generate declarations from comments (#30)
Diffstat (limited to 'tools/may_execute_js_code.js')
-rw-r--r--tools/may_execute_js_code.js29
1 files changed, 8 insertions, 21 deletions
diff --git a/tools/may_execute_js_code.js b/tools/may_execute_js_code.js
index 9575582..2dec177 100644
--- a/tools/may_execute_js_code.js
+++ b/tools/may_execute_js_code.js
@@ -1,22 +1,9 @@
-exports.declarate = function declarate() {
- return {
- "name": "may_execute_js_code",
- "description": "Runs the javascript code in node.js.",
- "parameters": {
- "type": "object",
- "properties": {
- "code": {
- "type": "string",
- "description": "Javascript code to execute, such as `console.log(\"hello world\")`"
- }
- },
- "required": [
- "code"
- ]
- }
- }
-}
-
-exports.execute = function execute(data) {
- eval(data.code)
+/**
+ * Runs the javascript code in node.js.
+ * @typedef {Object} Args
+ * @property {string} code - Javascript code to execute, such as `console.log("hello world")`
+ * @param {Args} args
+ */
+exports.main = function main({ code }) {
+ eval(code);
}