mirror of
https://github.com/litruv/picoGraph.git
synced 2026-07-24 02:36:04 +10:00
Initial commit
moved from private version control
This commit is contained in:
30
scripts/nodes/library/getVariable.js
Normal file
30
scripts/nodes/library/getVariable.js
Normal file
@@ -0,0 +1,30 @@
|
||||
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;
|
||||
},
|
||||
}
|
||||
);
|
||||
Reference in New Issue
Block a user