Update isNode

Resolves #1731
This commit is contained in:
Chalarangelo
2021-04-02 11:45:13 +03:00
parent e0e23aaae4
commit 9847eb4985

View File

@ -6,13 +6,13 @@ tags: node,browser,intermediate
Determines if the current runtime environment is Node.js. Determines if the current runtime environment is Node.js.
- Use the `process` global object that provides information about the current Node.js process. - Use the `process` global object that provides information about the current Node.js process.
- Check if `process` is defined and `process.versions`, `process.versions.node` are not `null`. - Check if `process`, `process.versions` and `process.versions.node` are defined.
```js ```js
const isNode = () => const isNode = () =>
typeof process !== 'undefined' && typeof process !== 'undefined' &&
process.versions !== null && !!process.versions &&
process.versions.node !== null; !!process.versions.node;
``` ```
```js ```js