[Home] >  Misc >  Check if the code is running in NodeJS

Check if the code is running in NodeJS

JavaScript version

const isNode = typeof process !== 'undefined' && process.versions != null && process.versions.node != null;

TypeScript version

const isNode: boolean = typeof process !== 'undefined' && process.versions != null && process.versions.node != null;