mirror of
https://github.com/litruv/picoGraph.git
synced 2026-07-24 02:36:04 +10:00
31 lines
764 B
JavaScript
31 lines
764 B
JavaScript
import { createNodeModule } from "../nodeTypes.js";
|
|
|
|
/**
|
|
* Exposes the current value of a variable.
|
|
*/
|
|
export const getVariableNode = createNodeModule(
|
|
{
|
|
id: "get_var",
|
|
title: "Get Variable",
|
|
category: "Logic",
|
|
description: "Expose the current value of a variable.",
|
|
searchTags: ["get", "read", "variable", "access"],
|
|
inputs: [],
|
|
outputs: [{ id: "value", name: "Value", direction: "output", kind: "any" }],
|
|
properties: [
|
|
{
|
|
key: "name",
|
|
label: "Variable Name",
|
|
type: "string",
|
|
defaultValue: "score",
|
|
},
|
|
],
|
|
},
|
|
{
|
|
evaluateValue: ({ node, sanitizeIdentifier }) => {
|
|
const name = sanitizeIdentifier(String(node.properties.name ?? "var"));
|
|
return name;
|
|
},
|
|
}
|
|
);
|