Is it possible to define standard JS functions and call them normally as well as trigger them from (Meteor) events? I'm currently learning about Methods in Meteor and wondering if it's acceptable to write functions inside my isClient conditional and invoke them. For example, here is a snippet where the second function 'normalize_scale_offset' is invoked by a Meteor event.
function normalize(value, max=1, min=0.1) {
return (value - min) / (max - min);
};
function normalize_scale_offset(input, scale=1, offset=0) {
var normalized = input.map((value) => normalize(value, Math.max(...input), Math.min(...input)));
return normalized.map( (value) => value * scale + Math.sqrt(offset) ).map((value) => value * 1000);
};