Learn how to use 0CodeKit’s JavaScript Executor to detect duplicates, sort data, and more with JS examples. No coding skills required with our code generators!
In a previous blog post, we looked at how Python can be executed in Make and gave some automation examples. So, I guess it is time we switched to JavaScript! We’ll go step-by-step on how you can use our JavaScript Code Executor in Make to tackle ordinary tasks.
*Do not worry if you are new to programming. With the help of our AI-powered JavaScript Code Generator, you just have to say what you want, and it'll generate the code for you.*
Here are three real-life examples of how JavaScript can help automate your processes in Make. These examples show how data of other Make modules can be processed to provide you with the results that you want.
When you're out to buy fruits in a week, you have a list of the fruits you have purchased and another list with the remaining fruits that you need to purchase. One can easily end up mixing the lists and put some fruit in the basket for the second time. But what if there existed a solution that could easily detect whether items had been repeated at all?
This is where Make’s “Set Multiple Variables” module comes in handy. First, you’ll create two variables:
Once these variables are set, you pass them to 0CodeKit’s JavaScript Code Executor. It takes the two lists and compares them to establish which fruits repeated themselves. If that is the case, then the output will be <true> helping you sort out the situation before you are left with too many bananas.
Now, imagine you’re monitoring the weather for a gardening project or class experiment. You have a list of temperatures, but you only care about the times when it dipped below 20°C. Doing this by hand can be tedious and easy to mess up.
Let's say, you're tracking the weather for a gardening activity or a school project. You have one list of temperatures, but you are only interested in the time points when the temperature was below 20°C. While it can be done manually, it is time-consuming and prone to errors.
Using the “Set Variable” module in Make, you’ll store your list of temperatures. Then, pass the data to 0CodeKit’s JavaScript Code Executor, and it will do the rest. The code scans the list, pulls out any temperatures under 20°C. No more scrolling through data – just the exact information you need, fast.
In a “Set Variable” module in Make, you will enter the list of temperatures. Then, pass the data to 0CodeKit’s JavaScript Code Executor and it will finish the job for you. The code scans the list and extracts temperature below 20°C.
Suppose you are working as a library manager, and you need to verify which books are displayed and which are kept in storage. This is like the first use case but has an additional feature. This time, you can use an external library like Lodash for extra functionality.
You’ll start by defining two variables in Make:
With 0CodeKit’s, together with Lodash, the code will simply go through the two lists and return only the specific books that are on both lists. This way, you can determine quickly, and easily which books are stored twice in your store and storage instead of going through a series of spreadsheets.
0CodeKit’s Code Executors can always be used to automate repetitive tasks, thereby making your work easier and more accurate. Either if you want to find duplicated items, sort data, or compare lists, 0CodeKit does all the hard work for you.
The rich text element allows you to create and format headings, paragraphs, blockquotes, images, and video all in one place instead of having to add and format them individually. Just double-click and easily create content.
A rich text element can be used with static or dynamic content. For static content, just drop it into any page and begin editing. For dynamic content, add a rich text field to any collection and then connect a rich text element to that field in the settings panel. Voila!
Headings, paragraphs, blockquotes, figures, images, and figure captions can all be styled after a class is added to the rich text element using the "When inside of" nested selector system.