Object
The Object node in Magick is a fundamental utility node that allows you to create, manipulate, and output JavaScript objects within your spells. It provides a simple way to work with structured data and can be used in a wide variety of scenarios.Inputs
a(object, default:{}): The input object to be processed or modified by the node. If no input is provided, an empty object{}will be used as the default.
Outputs
result(object): The resulting object after any modifications or transformations have been applied.
Configuration
This node does not have any additional configuration options.Usage
- Add an Object node to your spell.
- Connect the desired input object to the
ainput port. If you want to start with an empty object, you can skip this step. - The Object node will output the input object as-is, without any modifications, through the
resultoutput port. - You can then connect the
resultoutput to other nodes in your spell to perform further operations or use the object data as needed.
Example
Here’s a simple example of how you can use the Object node in a Magick spell:- The Object node
object1is created with an input object containing properties likename,age, andcity. - The
resultoutput ofobject1is connected to themessageinput of a Debug Log nodelog1. - When the spell is run, the Debug Log node will log the object data to the console.
Best Practices
- Use the Object node to create and manage structured data within your spells.
- Connect the
resultoutput to other nodes that expect object data as input. - If you need to modify the object, you can use other nodes like the Edit Object node to add, remove, or update properties.
Common Issues
- Ensure that the input data connected to the
ainput port is a valid JavaScript object. Passing non-object data may lead to unexpected behavior. - Be mindful of the object structure and property names when accessing or modifying the object data in other nodes.
