Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shinnn/platform-name
Convert a Node.js platform identifier to the human-readable platform name
https://github.com/shinnn/platform-name
Last synced: 26 days ago
JSON representation
Convert a Node.js platform identifier to the human-readable platform name
- Host: GitHub
- URL: https://github.com/shinnn/platform-name
- Owner: shinnn
- License: isc
- Created: 2017-05-10T10:47:02.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-04-18T08:13:38.000Z (over 5 years ago)
- Last Synced: 2024-09-17T23:14:47.604Z (about 2 months ago)
- Language: JavaScript
- Size: 55.7 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# platform-name
[![npm version](https://img.shields.io/npm/v/platform-name.svg)](https://www.npmjs.com/package/platform-name)
[![Build Status](https://travis-ci.com/shinnn/platform-name.svg?branch=master)](https://travis-ci.com/shinnn/platform-name)
[![codecov](https://codecov.io/gh/shinnn/platform-name/branch/master/graph/badge.svg)](https://codecov.io/gh/shinnn/platform-name)Convert a [Node.js platform identifier](https://nodejs.org/api/os.html#os_os_platform) into a human-readable platform name
```javascript
const platformName = require('platform-name');platformName('aix'); //=> 'AIX'
platformName('android'); //=> 'Android'
platformName('darwin'); //=> 'macOS'
platformName('freebsd'); //=> 'FreeBSD'
platformName('linux'); //=> 'Linux'
platformName('openbsd'); //=> 'OpenBSD'
platformName('sunos'); //=> 'Solaris'
platformName('win32'); //=> 'Windows'
```## Installation
[Use](https://docs.npmjs.com/cli/install) [npm](https://docs.npmjs.com/about-npm/).
```
npm install platform-name
```## API
```javascript
const platformName = require('platform-name');
```### platformName([*id*])
*id*: `string` (one of `aix` `android` `darwin` `freebsd` `linux` `openbsd` `sunos` `win32`)
Return: `string`Uses [`process.platform`](https://nodejs.org/api/process.html#process_process_platform) when it takes no arguments.
```javascript
//On macOSplatformName('linux'); //=> 'Linux'
platformName(); //=> 'macOS'
```### platformName.map
Type: `Map`
ID-name pairs used inside this module.
```javascript
platformName.map.get('win32'); //=> 'Windows'
```## License
[ISC License](./LICENSE) © 2018 - 2019 Shinnosuke Watanabe