Dear users,
as we receive many requests and questions from users migrating to Tape regarding modern JavaScript (JS) syntax, we thought about how to best support you in the process.
Many of the systems that users migrate from, such as Podio, use an outdated JavaScript syntax (ES5).
What does this mean?
Tape supports ES2021 JS, which is more concise, and fully downwards compatible to ES5 syntax.
A tangible example for easier code could be arrow functions. In ES5, one may have used a map
like this:
names.map(function(n) { return n.toUpperCase(); }).join(' ')
Where the modern version is easier to read:
names.map(n => n.toUpperCase()).join(' ');
There are countless more examples, many can be found in the W3 standard document.
Support your migration to modern JS
We will use this thread here as a collection for ideas on how to improve your calculation field scripts’ readability and maintainability by leveraging the modern JS syntax.
- Autoconvert ES5 code to modern JS: You can use the open source solution Lebab to convert code automatically: Lebab Online - Note that you may need to replace tokens with variable names, as it may not be able to understand the field token syntax. It works almost perfectly for coherent small code snippets.
- Learning the benefits starting from ES6+ via a tutorial: ES6 Tutorial
This is only a head-start, please feel free to add your questions and ideas here regarding migration to the modern syntax in calculation fields. We are looking forward to your ideas and input!
Cheers & keep on scripting
Tim