Your port has two files now: readings.js exports the parsing function, and digest.js imports it. Where Dev runs python digest.py, you run node digest.js. Both Python files end with a main guard, but JavaScript has no __name__ to check. You’ll see why the port mostly doesn’t need a guard and what you write in readings.js instead to keep its self-check.
Let the Entry File Do the Work
The Python tool is already split the way JavaScript programs are: readings.py is a module, and digest.py is the file Dev runs. Python convention still wraps the entry file’s work in main() behind if __name__ == "__main__":, so tests or tools can import it safely. Ported as it is, if (__name__ === "__main__") stops with ReferenceError: __name__ is not defined, because JavaScript has no such variable.
The entry file is the one you hand to node, and JavaScript convention doesn’t guard it. Most modules only export, so importing them does nothing visible. Anything worth importing or testing lives in a module like readings.js, so nothing imports the entry file, and its top level is the program. readings.js still exports the parseLine() you ported earlier:
readings.js
export function parseLine(line) {
const [time, temp] = line.trim().split(",");
return { time, temp: Number(temp) };
}