feat: Add getOS()

This commit is contained in:
peaceiris 2019-09-18 09:59:07 +09:00
parent 4b6109cfb2
commit 86eb62d73e
5 changed files with 35 additions and 26 deletions

13
lib/get-os.js Normal file
View file

@ -0,0 +1,13 @@
function getOS(platform) {
if (platform === "linux") {
return "Linux";
} else if (platform === "darwin") {
return "macOS";
} else if (platform === "win32") {
throw new Error("Windows is not supported");
} else {
throw new Error(`${platform} is not supported`);
}
}
module.exports = getOS;