Using Lodash in Unqork


Put simply, Lodash is a Javascript library of functions. You can use these functions to complete common tasks in Unqork. You'll write Lodash as a formula with parameters relative to the function you decide to use. For example, _.set is a Lodash function. This function accepts 3 parameters to set a new object value.

What You'll Learn

In this article, you'll learn:

Where to Use Lodash in Unqork

Unqork allows you to use Lodash anywhere you can write a formula. For example, you can use Lodash in a Calculator component or a Decisions component. You can also use Lodash in any of the formula operators in a Data Workflow.

For example, say you want to use a Calculator component to set key:value pairs in an object. You can use the _.set Lodash function from earlier to set the value and path of your object. To do this, you write the function as an output formula in your Calculator component.

Writing Lodash Functions

Before you write your Lodash function, decide which function to use. To do that, visit the function library documentation here:

Writing Lodash in Unqork differs from how you write it elsewhere. Typically, Lodash functions start with a _. followed by the function name and its parameters. In Unqork, you write Lodash formulas as follows: =LODASH("method", parameter 1, parameter 2).

Here's a breakdown of how each part of the formula operates: 

Part of Formula Description


Tells Unqork that you're using a Lodash-type function.


Declares which Lodash function you're using. You must write your functions in camelCase between double-quotes.

NOTE  When copy/pasting double-quotes, confirm they aren't stylized. Adding stylized double-quotes might result in an error.

parameter 1, parameter 2

Declares the parameters of the function you're using. You must write these parameters in the same order as the Lodash documentation referenced above.

NOTE  If your parameter uses a hard coded value, you'll enter it between double-quotes. If your parameter references a variable, quotes aren't necessary.

Apply your formula to a Lodash function. To do that, return to the example from earlier when you set key:value pairs in an object. Looking at the Lodash library, you see it written out as _.set(object, path, value). In your Unqork formula, write this as =LODASH("set", object, path, value).