Module: Formatter

Formatter function is used to format data when DataModel is deserialized. This function is called for every row of the data model with the value, rowId and schema. This function is expected to return a single value for each row of a variable. This formatter function is only used for output purpose.
Parameters:
Name Type Description
value any value of the variable needs to be formatted for a particular row
rowId Number row id of the row being iterated
schema Schema schema of the variable
Source:
Returns:
formatted values
Type
any
Example
const dateFormatter = (dateInMS) => {
     const d = new Date(dateInMS);
     return [d.getFullYear(), d.getMonth(), d.getDay()].join('-')
 };

 const data = dm.getData({
     formatter: {
         shippingDate: dateFormatter
     }
 });

 console.log(data);