503 B
503 B
title, tags
| title | tags |
|---|---|
| isNode | node,browser,intermediate |
Determines if the current runtime environment is Node.js.
- Use the
processglobal object that provides information about the current Node.js process. - Check if
processis defined andprocess.versions,process.versions.nodeare notnull.
const isNode = () =>
typeof process !== 'undefined' &&
process.versions !== null &&
process.versions.node !== null;
isNode(); // true (Node)
isNode(); // false (browser)