https://kotlinlang.org logo
#javascript
Title
# javascript
e

Edoardo Luppi

12/04/2023, 10:54 AM
Is there a property or function from the JS stdlib I can use to check if I'm in Node.js? Or do I have to implement my own.
a

Artem Kobzar

12/04/2023, 11:03 AM
No. You can try define something like this:
Copy code
val isNodeJs: Boolean get() = js("typeof process === 'object' && process.versions !== undefined && process.versions.node !== undefined")
e

Edoardo Luppi

12/04/2023, 11:04 AM