Socket
Socket
Sign inDemoInstall

os-name

Package Overview
Dependencies
21
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.1 to 3.0.0

31

index.js
'use strict';
var os = require('os');
var macosRelease = require('macos-release');
var winRelease = require('win-release');
const os = require('os');
const macosRelease = require('macos-release');
const winRelease = require('windows-release');
module.exports = function (platform, release) {
module.exports = (platform, release) => {
if (!platform && release) {

@@ -12,9 +12,12 @@ throw new Error('You can\'t specify a `release` without specifying `platform`');

platform = platform || os.platform();
release = release || os.release();
var id;
let id;
if (platform === 'darwin') {
var prefix = Number(release.split('.')[0]) > 15 ? 'macOS' : 'OS X';
id = macosRelease(release).name;
if (!release && os.platform() === 'darwin') {
release = os.release();
}
const prefix = release ? (Number(release.split('.')[0]) > 15 ? 'macOS' : 'OS X') : 'macOS';
id = release ? macosRelease(release).name : '';
return prefix + (id ? ' ' + id : '');

@@ -24,3 +27,7 @@ }

if (platform === 'linux') {
id = release.replace(/^(\d+\.\d+).*/, '$1');
if (!release && os.platform() === 'linux') {
release = os.release();
}
id = release ? release.replace(/^(\d+\.\d+).*/, '$1') : '';
return 'Linux' + (id ? ' ' + id : '');

@@ -30,3 +37,7 @@ }

if (platform === 'win32') {
id = winRelease(release);
if (!release && os.platform() === 'win32') {
release = os.release();
}
id = release ? winRelease(release) : '';
return 'Windows' + (id ? ' ' + id : '');

@@ -33,0 +44,0 @@ }

{
"name": "os-name",
"version": "2.0.1",
"description": "Get the name of the current operating system. Example: macOS Sierra",
"license": "MIT",
"repository": "sindresorhus/os-name",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js"
],
"keywords": [
"os",
"operating",
"system",
"platform",
"name",
"title",
"release",
"version",
"macos",
"osx",
"windows",
"linux"
],
"dependencies": {
"macos-release": "^1.0.0",
"win-release": "^1.0.0"
},
"devDependencies": {
"ava": "*",
"xo": "*"
}
"name": "os-name",
"version": "3.0.0",
"description": "Get the name of the current operating system. Example: macOS Sierra",
"license": "MIT",
"repository": "sindresorhus/os-name",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=6"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js"
],
"keywords": [
"os",
"operating",
"system",
"platform",
"name",
"title",
"release",
"version",
"macos",
"windows",
"linux"
],
"dependencies": {
"macos-release": "^2.0.0",
"windows-release": "^3.1.0"
},
"devDependencies": {
"ava": "^0.25.0",
"xo": "^0.23.0"
}
}

@@ -12,3 +12,3 @@ # os-name [![Build Status](https://travis-ci.org/sindresorhus/os-name.svg?branch=master)](https://travis-ci.org/sindresorhus/os-name)

```
$ npm install --save os-name
$ npm install os-name
```

@@ -23,3 +23,3 @@

// on a macOS Sierra system
// On a macOS Sierra system

@@ -47,7 +47,7 @@ osName();

By default the name of the current operating system is returned.
By default, the name of the current operating system is returned.
You can optionally supply a custom [`os.platform()`](http://nodejs.org/api/os.html#os_os_platform) and [`os.release()`](http://nodejs.org/api/os.html#os_os_release).
You can optionally supply a custom [`os.platform()`](https://nodejs.org/api/os.html#os_os_platform) and [`os.release()`](https://nodejs.org/api/os.html#os_os_release).
Check out [getos](https://github.com/wblankenship/getos) if you need the Linux distribution name.
Check out [`getos`](https://github.com/wblankenship/getos) if you need the Linux distribution name.

@@ -54,0 +54,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc