feat: add Platform.isWindows static method to check for Windows OS
Add a new `isWindows` static method to the `Platform` class that returns `true` when the host operating system name equals "Windows". This provides a less stringly-typed API compared to checking `Platform.name` directly. The implementation is a simple delegation to the existing `name` foreign method, comparing it against the "Windows" string. Includes a test that verifies `Platform.isWindows` is equivalent to `Platform.name == "Windows"`.
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
class Platform {
|
||||
foreign static isPosix
|
||||
foreign static name
|
||||
|
||||
static isWindows { name == "Windows" }
|
||||
}
|
||||
|
||||
class Process {
|
||||
|
||||
@@ -3,6 +3,8 @@ static const char* osModuleSource =
|
||||
"class Platform {\n"
|
||||
" foreign static isPosix\n"
|
||||
" foreign static name\n"
|
||||
"\n"
|
||||
" static isWindows { name == \"Windows\" }\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"class Process {\n"
|
||||
|
||||
Reference in New Issue
Block a user