3 ms·
I wouldn't use it but I can see why this might happen. The correct solution would be process.platform === "win32" but if you aren't familiar with Windows then
by tonyedgecombe 7y ago
I wouldn't use it but I can see why this might happen.
The correct solution would be process.platform === "win32" but if you aren't familiar with Windows then you might not realise this includes 64 bit Windows or Windows Server.
If process.isWindows() existed in the standard library nobody would be concerned about it.
- datpuz 7y agoI'd argue that having the function process.isWindows() would be a bad design. You'd then need to add process.isMacOS(), process.isLinux(), etc. You can do a switch statement on process.platform.
- tonyedgecombe 7y agoI’m not sure a switch statement against a string is a great solution either although to some extent you are restrained by JavaScripts limitations.
- OskarS 7y agoOk, but lets say you're doing something that requires an isWindows() function. You search NPM, you find this package. At this point, do you not even look at the code? Like, even a glance would make you aware that all it's doing is comparing with "win32", which you can trivially do yourself. So why use the package at all, then? All it adds is overhead. No, clearly the people who use this package has not taken even a second to review the code, because it if they had, they'd know that it was trivial. Security-wise, that's deeply troubling.
- slooonz 7y agoWait, do people look at the code of the librairies they’re using in Java/PHP/Python/C++/Go/… ?
- e12e 7y agoDoes it (in)correctly identify ReactOS? That's what I want to know...