Checks if the current environment is Node.js.
Tests for the presence of process.versions.node.
true if running in Node.js environment
if (isNode()) { // Safe to use Node.js APIs const fs = require('fs'); const data = fs.readFileSync('file.txt', 'utf8');} Copy
if (isNode()) { // Safe to use Node.js APIs const fs = require('fs'); const data = fs.readFileSync('file.txt', 'utf8');}
Checks if the current environment is Node.js.
Tests for the presence of process.versions.node.