How to: Set Object Values Using Lodash
Overview
When using Unqork, you might want to create or change the values of an object. To do that, use the _.create and _.set Lodash functions.
To read more about the parameters of the _.create and _.set Lodash functions, visit: https://lodash.com/docs/4.17.15.
How This Example Works
In this example, you'll use the _.create and _.set Lodash functions to create and alter your object path and value. First, you'll create an object using the _.create function. Next, you'll use end-user End-users, also known as Express Users, are the individuals accessing an application through Express View. In most cases, end-users are the customers using the product. input to alter the key/value pair of your object using the _.set function to set the path, or key, and value of your created object. Then, your module outputs the new key/value pair to the end-user.
Here are the basic steps for this example:
1. | Your Calculator component creates a new object. |
2. | The end-user enters their key and value to hardcode into the object. |
3. | The object's key/value pair is hardcoded with the end-user's input. |
4. | The new object values display to the end-user. |
Here's how the comnfiguration looks in the Module Builder:
Resources