Data Transformer - Quick Reference

The data transformer is intended take text from the input and transform it, then place it in the output. No data is shared or sent to our server unless you choose to save it. To do this you will need to have an Electric Llama Company account

To perform a data transformation, you have to do all the hard work, by writing Javascript in the code editor at the bottom of the screen.

The text in the input editor is made available as the variable input and the text in the output can be set by setting the output variable.

A number of useful transformer examples are given below to get you started.

If you have an Electric Llama Company account, you can save any transformers you have written for later use, alternatively each text editor has a download to desktop option.

You can drag and drop files into any of the editors on the transformer page.

Examples


The Data Transformer has a few helper functions to make common actions easier.

These functions are provided by an instance of the DataTransformer or DT for short. 

Often input data is based on a record per line. 

DT.toLines( data, rowSeparator ) converts the data to an array of lines of text. 

DT.linesToString( lines, separator ) converts an array of lines to a string

DT.forEachLine( fn, data) apply a function to each line of text in the data.

DT.toTable(data, rowSeparator, cellSeparator);

DT.tableToString(table, rowSeparator, cellSeparator);

DT.NL the new line character

DT.TAB the tab character