isNodeRuntime function
Returns true when the executing JS host is Node.js.
We detect Node by the presence of globalThis.process.versions.node.
Implementation
bool isNodeRuntime() {
final process = jsGlobal.getProperty<JSAny?>('process'.toJS);
if (process == null) return false;
final versions = (process as JSObject).getProperty<JSAny?>('versions'.toJS);
if (versions == null) return false;
final nodeVersion = (versions as JSObject).getProperty<JSAny?>('node'.toJS);
return nodeVersion != null && nodeVersion.isA<JSString>();
}