node: strict platform value (#14134)

* node: strict platform value

From: https://nodejs.org/api/os.html#os_os_platform

> Currently possible values are:
>
> - 'aix'
> - 'darwin'
> - 'freebsd'
> - 'linux'
> - 'openbsd'
> - 'sunos'
> - 'win32'
>
> Equivalent to process.platform.

* node: add missing 'android' to platforms

* node: improve platform strings also in v7
This commit is contained in:
Linda_pp
2017-01-22 21:11:34 -08:00
committed by Mohamed Hegazy
parent 0b89ca3e31
commit 5b9724a373
3 changed files with 22 additions and 5 deletions
+11 -2
View File
@@ -347,6 +347,15 @@ declare namespace NodeJS {
openssl: string;
}
type Platform = 'aix'
| 'android'
| 'darwin'
| 'freebsd'
| 'linux'
| 'openbsd'
| 'sunos'
| 'win32';
export interface Process extends EventEmitter {
stdout: WritableStream;
stderr: WritableStream;
@@ -399,7 +408,7 @@ declare namespace NodeJS {
pid: number;
title: string;
arch: string;
platform: string;
platform: Platform;
mainModule?: NodeModule;
memoryUsage(): MemoryUsage;
cpuUsage(previousValue?: CpuUsage): CpuUsage;
@@ -1311,7 +1320,7 @@ declare module "os" {
},
};
export function arch(): string;
export function platform(): string;
export function platform(): NodeJS.Platform;
export function tmpdir(): string;
export var EOL: string;
export function endianness(): "BE" | "LE";
-1
View File
@@ -1481,7 +1481,6 @@ namespace os_tests {
result = os.endianness();
result = os.hostname();
result = os.type();
result = os.platform();
result = os.arch();
result = os.release();
result = os.EOL;
+11 -2
View File
@@ -347,6 +347,15 @@ declare namespace NodeJS {
openssl: string;
}
type Platform = 'aix'
| 'android'
| 'darwin'
| 'freebsd'
| 'linux'
| 'openbsd'
| 'sunos'
| 'win32';
export interface Process extends EventEmitter {
stdout: WritableStream;
stderr: WritableStream;
@@ -399,7 +408,7 @@ declare namespace NodeJS {
pid: number;
title: string;
arch: string;
platform: string;
platform: Platform;
mainModule?: NodeModule;
memoryUsage(): MemoryUsage;
cpuUsage(previousValue?: CpuUsage): CpuUsage;
@@ -1262,7 +1271,7 @@ declare module "os" {
},
};
export function arch(): string;
export function platform(): string;
export function platform(): NodeJS.Platform;
export function tmpdir(): string;
export var EOL: string;
export function endianness(): "BE" | "LE";