# Custom javascript map and filter functions for time series nodes

**URL:** <https://forums.losant.com/t/custom-javascript-map-and-filter-functions-for-time-series-nodes/5115>\
**Category:** Feature Request\
**Tags:** time-series\
**Created:** [June 16, 2023, 6:58am UTC](https://forums.losant.com/t/custom-javascript-map-and-filter-functions-for-time-series-nodes/5115 "2023-06-16T06:58:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marco\_Bernutz](https://avatars.discourse-cdn.com/v4/letter/m/db5fbb/32.png) [@Marco\_Bernutz](https://forums.losant.com/u/Marco_Bernutz)\
**Post date:** [June 16, 2023, 6:58am UTC](https://forums.losant.com/t/custom-javascript-map-and-filter-functions-for-time-series-nodes/5115/1 "2023-06-16T06:58:30Z")

</div>

Hi, your recent changes to the time series node reduce a lot custom efforts 🙂 I think that having also the option of custom mapping or filter functions directly in the node config and automatically applied to the result set before returning it could additionally reduce slow (boilerplate) code.

---

<div class="post-metadata">

**Author:** ![Dylan\_Schuster](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/dylan_schuster/32/2850_2.png) [@Dylan\_Schuster](https://forums.losant.com/u/Dylan_Schuster)\
**Post date:** [June 16, 2023, 2:06pm UTC](https://forums.losant.com/t/custom-javascript-map-and-filter-functions-for-time-series-nodes/5115/2 "2023-06-16T14:06:17Z")

</div>

Are you suggesting something kind of like we do in the [Time Series Graph](https://docs.losant.com/dashboards/blocks/time-series-graph/) dashboard block, where we allow for applying an [expression](https://docs.losant.com/workflows/accessing-payload-data/#expressions) to each point prior to displaying it on the graph?

---

<div class="post-metadata">

**Author:** ![Marco\_Bernutz](https://avatars.discourse-cdn.com/v4/letter/m/db5fbb/32.png) [@Marco\_Bernutz](https://forums.losant.com/u/Marco_Bernutz)\
**Post date:** [June 19, 2023, 7:15am UTC](https://forums.losant.com/t/custom-javascript-map-and-filter-functions-for-time-series-nodes/5115/3 "2023-06-19T07:15:06Z")

</div>

Yes - expressions as in the Time Series Graph would be a convenient solution for simple conversions.

---

<div class="post-metadata">

**Author:** ![Dylan\_Schuster](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/dylan_schuster/32/2850_2.png) [@Dylan\_Schuster](https://forums.losant.com/u/Dylan_Schuster)\
**Post date:** [June 20, 2023, 2:01pm UTC](https://forums.losant.com/t/custom-javascript-map-and-filter-functions-for-time-series-nodes/5115/4 "2023-06-20T14:01:18Z")

</div>

Understood. I’ll file a feature request.

An easy-ish workaround you could use in the meantime is to follow up your Time Series Node with a [Mutate Node](https://docs.losant.com/workflows/logic/mutate/), setting a new value, with the “Treat as JSON” box checked.

You could then write the body something like the following (untested) …

```plaintext
[
{{#each myTimeSeriesPoints}}
{
  "mutatedValue": {{evalExpression 'sin({{this)}}' value}},
  "time": {{jsonEncode time}}
  {{#unless @last}},{{/unless}}
}
]

```
